Open kowczarz opened 1 year ago
Hi @kowczarz, Thank you for filing this issue, I'll try to separate a time for it soon. If you have some free time and you would like to help, please go ahead and make a PR.
Seeing same issue, any progress here? What I see is that I cannot use ref
without an error here.
<TextInput
ref={emailField} // will see little red line here
/>
Error for ref is: Type '{ ref: MutableRefObject
I do have the same issue when assigning ref
to TextInputs
Type '{ value: string; label: string; onChangeText: (value: string) => void; ref: React.MutableRefObject<any>; onSubmitEditing: () => void; }' is not assignable to type 'TextInputProps'.
Object literal may only specify known properties, and 'ref' does not exist in type 'TextInputProps'.ts(2322)
Any solution or workaround?
Currently e.g.
TextInput
allows using ref, it's defined as aReact.FC<TextInputProps>
. This cause TypeScript throws the given error:Easiest solution is removing the explicit type declaration, other approach would be replacement the current type with
ForwardRefExoticComponent<PropsWithoutRef<TextInputProps>> & RefAttributes<RNTextInput>
.The reason I'm creating this issue is I don't have time to ensure if there is no other places where this issue occurs.