react-native-google-places-autocomplete icon indicating copy to clipboard operation
react-native-google-places-autocomplete copied to clipboard

Bug Report - onPress not firing on Android on all version.

Open hugoh59 opened this issue 2 years ago • 5 comments

It simply stopped working for all version on Android. I'm not sure why, anybody else getting the issue as well ?

hugoh59 avatar Feb 22 '23 14:02 hugoh59

I thought the issue was related to input being inside a Flatlist but actually not! And on ios on the development version it works fine even in release mode but not on TestFlight and app store version.

hugoh59 avatar Feb 24 '23 15:02 hugoh59

I am also facing the same issue the onPress event is working fine on ios but not working on Android... If anyone has come to any solution please do let us know.

HassanNaeem555 avatar Mar 03 '23 11:03 HassanNaeem555

@hugoh59 @HassanNaeem555 I encountered the same issue while implementing this component a second time inside my app. While the first implementation was working just fine, the second wasn't. At some point I noticed that this started happening once I wrapped the GooglePlaces component in a ScrollView in order to dodge the VirtualizedLists error (see https://github.com/FaridSafi/react-native-google-places-autocomplete/issues/475), something that I didn't do in the first implementation since the screen was quite different. In case you are wrapping the component in the same way, make sure to pass the keyboardShouldPersistTaps='handled' prop to the wrapping ScrollView:

<ScrollView
  contentContainerStyle={contentContainerStyle}
  horizontal={true}
  keyboardShouldPersistTaps='handled' // HERE
  scrollEnabled={false}
>
    <GooglePlacesAutocomplete ... />
</ScrollView>

Doing so restored the correct onPress behavior on Android.

gguidotti avatar Mar 22 '23 14:03 gguidotti

Same issue, OnPress is working fine in emulator and simulator (Android and IOS) but not working on real android device checked on multiple real device, My device is Oppo

MrFarhan avatar May 10 '23 14:05 MrFarhan

@hugoh59 @HassanNaeem555 I encountered the same issue while implementing this component a second time inside my app. While the first implementation was working just fine, the second wasn't. At some point I noticed that this started happening once I wrapped the GooglePlaces component in a ScrollView in order to dodge the VirtualizedLists error (see #475), something that I didn't do in the first implementation since the screen was quite different. In case you are wrapping the component in the same way, make sure to pass the keyboardShouldPersistTaps='handled' prop to the wrapping ScrollView:

<ScrollView
  contentContainerStyle={contentContainerStyle}
  horizontal={true}
  keyboardShouldPersistTaps='handled' // HERE
  scrollEnabled={false}
>
    <GooglePlacesAutocomplete ... />
</ScrollView>

Doing so restored the correct onPress behavior on Android.

Thanks! this fixed my issue

akabeera avatar Sep 15 '23 03:09 akabeera