I am not using Expo. Code snippet:
<View style={{width: 300, height: 200, zIndex: 2}}>
<GooglePlacesAutocomplete
placeholder="Search"
fetchDetails={true}
onPress={(data, details = null) => {
// 'details' is provided when fetchDetails = true
console.log(data, details);
}}
query={{
key: googleAPIKey,
language: 'en',
}}
/>
</View>
Typing into the inputfield correctly populates a dropdown menu of options, but clicking an option in the dropdown simply makes the dropdown go away. The inputfield remains as though nothing was selected, and "onPress" never fires. Im on iOS simulator on the latest Big Sur.
I tested the code you provided, and it works for me. I'm guessing that you have something further up the tree that is blocking presses.
Closing for now, as this doesn't follow the issue template properly and this doesn't appear to be a problem with the library itself.
Might be related to using an M1 macbook then, as I have already run into other issues due to that.
If you have the component inside an ScrollView, add the property keyboardShouldPersistTaps="handled" to the ScrollView
If issue still persist, then check if your parent component is Flatlist or Scrollview. if yes then add
keyboardShouldPersistTaps={'always'}.
this will resolve OnPress @oscadev
Most helpful comment
If you have the component inside an ScrollView, add the property keyboardShouldPersistTaps="handled" to the ScrollView