react-native-ui-lib
Version:
<p align="center"> <img src="https://user-images.githubusercontent.com/1780255/105469025-56759000-5ca0-11eb-993d-3568c1fd54f4.png" height="250px" style="display:block"/> </p> <p align="center">UI Toolset & Components Library for React Native</p> <p a
31 lines (30 loc) • 1.03 kB
TypeScript
import React from 'react';
import { TextInputProps } from 'react-native';
import validators from './validators';
export declare type Validator = Function | keyof typeof validators;
interface FieldState {
value?: string;
isFocused: boolean;
isValid: boolean;
hasValue: boolean;
}
export interface FieldStateInjectedProps {
fieldState: FieldState;
onFocus: Function;
onBlur: Function;
ref?: any;
}
export interface FieldStateProps extends TextInputProps {
validateOnStart?: boolean;
validateOnChange?: boolean;
validateOnBlur?: boolean;
/**
* A single or multiple validator. Can be a string (required, email) or custom function.
*/
validate?: Validator | Validator[];
}
declare function withFieldState(WrappedComponent: React.ComponentType<FieldStateInjectedProps & TextInputProps>): {
({ validate, validateOnBlur, validateOnChange, validateOnStart, ...props }: FieldStateProps): JSX.Element;
displayName: string | undefined;
};
export default withFieldState;