I am trying to set focus on TextInput
when I click on edit button, but I am getting error.
Below is my code:
const MyProfileScreen = (props: any) => { const refsFocus = useRef(null); return (<><View><TextInput placeholder={'editable test'} placeholderTextColor={'red'} style={{color: 'red'}} ref={'lastNameRef'} /></View><TouchableOpacity onPress={()=> { refsFocus.lastNameRef.focus();} }><Text>Edit text input</Text></TouchableOpacity></> );};
But I am getting error on onPress={()=> { refsFocus.lastNameRef.focus();} }
Error Message:Property 'lastNameRef' does not exist on type 'MutableRefObject<null>'.
I am not able to figure out what I am doing wrong