You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have encountered this error while usign useRef hook
can you please give an example how to use this with useRef hook or functional component.
Here is my code:
const[household,setHousehold]=useState('')consthouseholdRef=useRef(null)return(<KeyboardAwareScrollViewgetTextInputRefs={()=>{return[householdRef]}}style={styles.container}><TextInputmultiline={true}placeholderTextColor={inputPlaceholderTextColor}placeholder='write your answer here..'style={styles.input}/><TextInputmultiline={true}placeholderTextColor={inputPlaceholderTextColor}placeholder='write your answer here..'style={styles.input}/><TextInputmultiline={true}placeholderTextColor={inputPlaceholderTextColor}placeholder='write your answer here..'style={styles.input}/><TextInputmultiline={true}placeholderTextColor={inputPlaceholderTextColor}placeholder='write your answer here..'style={styles.input}/><TextInput{...props}ref={householdRef}multiline={true}placeholderTextColor={inputPlaceholderTextColor}placeholder='write your answer here..'style={styles.input}/></KeyboardAwareScrollView>)
It depends on how you get the reference. If you set a function to the prop ref, you would get a instance and you would be able to use ref.isFocused(). But is a deprecated way, instead using a Ref object created with useRef is recommanded. Here is some sample code. You can check out the documentation of useRef.
I have encountered this error while usign useRef hook
can you please give an example how to use this with useRef hook or functional component.
Here is my code:
This is just a test so i have set only one ref.
The text was updated successfully, but these errors were encountered: