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

react native textinput ref typescript

$
0
0

Whats the right type to use in my text input ref ?

It shows me error on line " <TextInput ref <-">

const RefComponent = () => {  const inputRef = useRef<HTMLInputElement | null>(null);  return (<TextInput ref={inputRef} style={{height: 100, width: 500, backgroundColor: 'red', padding: 10}} />  )};

Error:

No overload matches this call.  Overload 1 of 2, '(props: TextInputProps | Readonly<TextInputProps>): TextInput', gave the following error.    Type 'MutableRefObject<HTMLInputElement | null>' is not assignable to type 'LegacyRef<TextInput> | undefined'.      Type 'MutableRefObject<HTMLInputElement | null>' is not assignable to type 'RefObject<TextInput>'.

What I am doing wrong ?


Viewing all articles
Browse latest Browse all 6287

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>