how to create ref for Autocomplete component from react-native-autocomplete-input for make it focus?

how to create ref with Autocomplete component react-native-autocomplete-input for focus function ?

so i have this code

<View 
           onTouchEndCapture={() => {this.inputCity.focus()}}>

                <Autocomplete
                    ref={inputCity => this.inputCity = inputCity}
                    
                />
            </View>

how to make autocomplete component focus when user trigger from view component?


Solution 1:

I think instead of using View and onTouchEndCapture, use TouchableOpacity and onPress function may focus Autocomplete

<TouchableOpacity
   onPress={()=>this.inputCity.focus()}>
    <Autocomplete
      ref={inputCity => this.inputCity = inputCity}/>
</TouchableOpacity>