Quantcast
Channel: Active questions tagged react-native+typescript - Stack Overflow
Viewing all articles
Browse latest Browse all 6287

React Native - react-hook-form and typescript usage

$
0
0

I wanted to write a generic Input component in react native with typescript for react-hook-form library.

type InputTextProps = {    name: any,    control: any}const InputText: FC<InputTextProps> = ({name, control, ...props}) => {    const {field} = useController({        name,        defaultValue: '',        control    })    return (<TextInput             value={field.value}            onChangeText={field.onChange}            {...props}        />    )}

In the above code, what should i use in InputTextProps ? I also want to extend TextInput's Props.

PS: Is using typescript in react native convenient ? I find is very much to be written especially for react navigation etc...


Viewing all articles
Browse latest Browse all 6287

Trending Articles