Skip to content

Incubator.TextField fixes #1288

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions generatedTypes/incubator/TextField/FieldContext.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/// <reference types="react" />
export declare type ContextType = {
export declare type FieldContextType = {
value?: string;
isFocused: boolean;
hasValue: boolean;
isValid: boolean;
failingValidatorIndex?: number;
disabled: boolean;
};
declare const FieldContext: import("react").Context<ContextType>;
declare const FieldContext: import("react").Context<FieldContextType>;
export default FieldContext;
9 changes: 7 additions & 2 deletions generatedTypes/incubator/TextField/FloatingPlaceholder.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/// <reference types="react" />
import { TextStyle, StyleProp } from 'react-native';
import { ColorType } from './types';
import { ColorType, ValidationMessagePosition } from './types';
export interface FloatingPlaceholderProps {
/**
* The placeholder for the field
Expand All @@ -14,9 +14,14 @@ export interface FloatingPlaceholderProps {
* Custom style to pass to the floating placeholder
*/
floatingPlaceholderStyle?: StyleProp<TextStyle>;
/**
* Should placeholder float on focus or when start typing
*/
floatOnFocus?: boolean;
validationMessagePosition?: ValidationMessagePosition;
}
declare const FloatingPlaceholder: {
({ placeholder, floatingPlaceholderColor, floatingPlaceholderStyle }: FloatingPlaceholderProps): JSX.Element;
({ placeholder, floatingPlaceholderColor, floatingPlaceholderStyle, floatOnFocus, validationMessagePosition }: FloatingPlaceholderProps): JSX.Element;
displayName: string;
};
export default FloatingPlaceholder;
6 changes: 5 additions & 1 deletion generatedTypes/incubator/TextField/Input.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { TextInput, TextInputProps } from 'react-native';
import { ForwardRefInjectedProps } from '../../commons/new';
import { ColorType } from './types';
export interface InputProps extends TextInputProps, React.ComponentPropsWithRef<typeof TextInput> {
export interface InputProps extends Omit<TextInputProps, 'placeholderTextColor'>, Omit<React.ComponentPropsWithRef<typeof TextInput>, 'placeholderTextColor'> {
/**
* A hint text to display when focusing the field
*/
Expand All @@ -11,6 +11,10 @@ export interface InputProps extends TextInputProps, React.ComponentPropsWithRef<
* Input color
*/
color?: ColorType;
/**
* placeholder text color
*/
placeholderTextColor?: ColorType;
}
declare const Input: {
({ style, hint, color, forwardedRef, ...props }: InputProps & ForwardRefInjectedProps): JSX.Element;
Expand Down
4 changes: 2 additions & 2 deletions generatedTypes/incubator/TextField/Presenter.d.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ContextType } from './FieldContext';
import { FieldContextType } from './FieldContext';
import { ColorType, Validator } from './types';
export declare function getColorByState(color: ColorType, context?: ContextType): string;
export declare function getColorByState(color?: ColorType, context?: FieldContextType): string | undefined;
export declare function validate(value?: string, validator?: Validator | Validator[]): [boolean, number?];
export declare function getRelevantValidationMessage(validationMessage: string | string[] | undefined, failingValidatorIndex: undefined | number): string | undefined;
12 changes: 7 additions & 5 deletions generatedTypes/incubator/TextField/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import { ValidationMessagePosition, Validator } from './types';
import { InputProps } from './Input';
import { ValidationMessageProps } from './ValidationMessage';
import { LabelProps } from './Label';
import { FieldContextType as _FieldContextType } from './FieldContext';
import { FloatingPlaceholderProps } from './FloatingPlaceholder';
import { CharCounterProps } from './CharCounter';
export declare type FieldContextType = _FieldContextType;
export declare type TextFieldProps = MarginModifiers & PaddingModifiers & TypographyModifiers & ColorsModifiers & InputProps & LabelProps & FloatingPlaceholderProps & ValidationMessageProps & Omit<CharCounterProps, 'maxLength'> & {
/**
* Pass to render a leading element
Expand Down Expand Up @@ -58,7 +60,7 @@ export declare type TextFieldProps = MarginModifiers & PaddingModifiers & Typogr
/**
* Internal style for the field container
*/
fieldStyle?: ViewStyle;
fieldStyle?: ViewStyle | ((context: FieldContextType) => ViewStyle);
/**
* Container style of the whole component
*/
Expand Down Expand Up @@ -116,7 +118,7 @@ declare const _default: React.ComponentClass<(Partial<Record<"margin" | "marginL
/**
* Internal style for the field container
*/
fieldStyle?: ViewStyle | undefined;
fieldStyle?: ViewStyle | ((context: _FieldContextType) => ViewStyle) | undefined;
/**
* Container style of the whole component
*/
Expand Down Expand Up @@ -171,7 +173,7 @@ declare const _default: React.ComponentClass<(Partial<Record<"margin" | "marginL
/**
* Internal style for the field container
*/
fieldStyle?: ViewStyle | undefined;
fieldStyle?: ViewStyle | ((context: _FieldContextType) => ViewStyle) | undefined;
/**
* Container style of the whole component
*/
Expand Down Expand Up @@ -226,7 +228,7 @@ declare const _default: React.ComponentClass<(Partial<Record<"margin" | "marginL
/**
* Internal style for the field container
*/
fieldStyle?: ViewStyle | undefined;
fieldStyle?: ViewStyle | ((context: _FieldContextType) => ViewStyle) | undefined;
/**
* Container style of the whole component
*/
Expand Down Expand Up @@ -281,7 +283,7 @@ declare const _default: React.ComponentClass<(Partial<Record<"margin" | "marginL
/**
* Internal style for the field container
*/
fieldStyle?: ViewStyle | undefined;
fieldStyle?: ViewStyle | ((context: _FieldContextType) => ViewStyle) | undefined;
/**
* Container style of the whole component
*/
Expand Down
4 changes: 2 additions & 2 deletions generatedTypes/incubator/TextField/useFieldState.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { TextInputProps } from 'react-native';
import { Validator } from './types';
export interface FieldStateProps extends TextInputProps {
import { InputProps } from './Input';
export interface FieldStateProps extends InputProps {
validateOnStart?: boolean;
validateOnChange?: boolean;
validateOnBlur?: boolean;
Expand Down
Loading