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

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

Open MrFarhan opened this issue 2 years ago • 5 comments

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!
  
import { GooglePlacesAutocomplete } from 'react-native-google-places-autocomplete';

const GooglePlaceInput = () => {
  const HandleOnPress = (data, details = null) => {
      console.log('on press clicked');
  };
  return (
      <GooglePlacesAutocomplete
          placeholder="Search"
          enablePoweredByContainer={false}
          onPress={HandleOnPress}
          // currentLocation={true}
          // currentLocationLabel="Current location"
          GooglePlacesDetailsQuery={{
              fields: ['formatted_address', 'geometry'],
          }}
          fetchDetails={true}
          keepResultsAfterBlur={true}
          filterReverseGeocodingByTypes={[
              'locality',
              'administrative_area_level_1',
              'country',
              'street_address',
              'postal_code',
              'street_number',
          ]}
          query={{
              key: '...MY_KEY...',
          }}
          renderRow={e => (
              <View
                  style={{
                      flexDirection: 'row',
                      width: '100%',
                  }}>
                  <ICONS.EvilIcons
                      name="location"
                      color={'green'}
                      size={SCALE(25)}
                      style={{ marginLeft: -5 }}
                  />
                  <Text
                      title={e.description}
                      style={{
                          justifyContent: 'flex-start',
                          width: '100%',
                          alignSelf: 'flex-start',
                      }}
                  />
              </View>
          )}
          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

  • Library Version: ^2.5.1

  • React Native Version: 0.71.5

  • [ ] iOS

  • [x] Android

  • [ ] Web

MrFarhan avatar May 10 '23 14:05 MrFarhan

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

pyryk408azlk avatar Jun 18 '23 21:06 pyryk408azlk

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

Works for me! thank u

lucianolopezz avatar Aug 04 '23 18:08 lucianolopezz

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

example:

        <ScrollView keyboardShouldPersistTaps="handled" >
            <GooglePlacesAutocomplete />
        </ScrollView>

gulsher7 avatar Oct 26 '23 13:10 gulsher7

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

harshilmobmaxime avatar Mar 21 '24 06:03 harshilmobmaxime