UI Components
Form Field
A reusable form field component that integrates React Hook Form with custom input styling
FormField is a reusable component that combines React Hook Form’s functionality with a custom Input component, providing a seamless form handling experience in React Native applications.
Installation
The FormField component relies on the following dependencies:
Here’s a complete example of how to use the FormField
component with various props:
Import
Features
- Seamless integration with React Hook Form
- Built-in error handling and validation
- Customizable styling
- Support for icons (left and right)
- TypeScript support with full type safety
- Keyboard type customization
- Secure text entry support for password fields
Props
Prop | Type | Required | Description |
---|---|---|---|
name | FieldPath<TFieldValues> | Yes | Field name for form registration |
control | Control<TFieldValues> | Yes | React Hook Form control object |
rules | RegisterOptions | No | Validation rules for the field |
placeholder | string | Yes | Placeholder text for the input |
secureTextEntry | boolean | No | Toggle password visibility (default: false) |
keyboardType | KeyboardTypeOptions | No | Keyboard type for input (default: ‘default’) |
leftIcon | React.ReactNode | No | Icon component to display on the left |
rightIcon | React.ReactNode | No | Icon component to display on the right |
containerStyle | ViewStyle | No | Style object for the container |
inputStyle | ViewStyle | No | Style object for the input |
Usage
Basic Usage
Was this page helpful?