FaridSafi / react-native-google-places-autocomplete

Customizable Google Places autocomplete component for iOS and Android React-Native apps
MIT License
2.01k stars 852 forks source link

On Press is Working fine on emulator and simulator but not working on Android device #883

Open MrFarhan opened 1 year ago

MrFarhan commented 1 year ago

Describe the bug

On Press is Working fine on emulator and simulator but not working on Android device

Reproduction:

Implement GooglePlacesAutocomplete npm as per the documentation, test on emulator and then test on real device

Please provide a FULLY REPRODUCIBLE example.

Click to expand! ```javascript import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete'; const GooglePlaceInput = () => { const HandleOnPress = (data, details = null) => { console.log('on press clicked'); }; return ( ( )} styles={{ textInputContainer: { width: '90%', alignSelf: 'center', borderBottomColor: 'black', borderRadius: 50, padding: 10, backgroundColor: '#F0F0F0', }, listView: { marginTop: 10, width: '100%', marginLeft: -35, }, description: { width: '100%', flexWrap: 'wrap', }, row: { padding: 13, width: '100%', }, textInput: { width: '100%', height: '100%', fontSize: 16, backgroundColor: '#F0F0F0', }, }} /> ); }; export default GooglePlaceInput; ```

Please remember to remove you google API key from the code you provide here

Additional context

pyryk408azlk commented 1 year ago

@MrFarhan try to add prop keepResultsAfterBlur={true}, maybe you use GooglePlace input inside of Modal, or ScrollView

lucianolopezz commented 1 year ago

@MrFarhan try to add prop keepResultsAfterBlur={true}, maybe you use GooglePlace input inside of Modal, or ScrollView

Works for me! thank u

gulsher7 commented 1 year ago

if you are using GooglePlaceAutocomplete inside ScrollView then pass prop keyboardShouldPersistTaps="handled" in ScrollView

example:

        <ScrollView keyboardShouldPersistTaps="handled" >
            <GooglePlacesAutocomplete />
        </ScrollView>
harshilmobmaxime commented 8 months ago

thanks @gulsher7 also work on KeyboardAwareScrollView <KeyboardAwareScrollView keyboardShouldPersistTaps={'handled'}>

rybaier commented 1 week ago

@pyryk408azlk @MrFarhan adding keepResultsAfterBlur directly in GooglePlacesAutoComplete worked for me as well