zubairpaizer / react-native-searchable-dropdown

Searchable Dropdown
148 stars 98 forks source link

Call focus method by reference #51

Open LuisRuda opened 4 years ago

LuisRuda commented 4 years ago

Hi, could someone help me with this problem?

I'm having trouble accessing the component reference and calling the focus method. I am trying as follows:

returnKeyType="next" onSubmitEditing={() => inputRef.current.focus()}

Prernabudh commented 3 years ago

Do as follows:

const inputRef = useRef()

<SearchableDropdown
textInputProps ={
ref:{inputRef}
}
/>

Then you can make use of this ref in submitEditing function.

onSubmitEditing={() => inputRef.current.focus()}