Skip to main content

FormInput

Wrapper for the InputBase. It connects input field to 'react-hook-form' library.

It takes care of props: onChangeText, onBlur, value, errorText. Overriding those props could break the form connection.

Example usage
<FormInput
controller={email}
label='Email'
onSubmitEditing={focusPassword}
iconName='mail-outline'
autoCapitalize='none'
/>

Forwarding ref

You can forward ref of type TextInput from React Native. With ref, you can check for example if the field is focused.

const nameRef = useRef<TextInput>(null)
// ...
<FormInput
ref={nameRef}
controller={inputController}
/>

Props

Every TextInput prop from react-native-paper is valid.

controller

Controller object returned from useController hook. Thanks to this prop the input is connected with a form.

import { useController } from 'react-hook-form'
// ...
const email = useController({
name: 'email',
// ...
})

<FormInput
controller={email}
/>