question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

react-native-google-places-autocomplete not working on React native 0.61

See original GitHub issue

Hi,

I have added react-native-google-places-autocomplete with yarn in my react-native cli project but it is not working. Here are the issues I am facing at the moment.

  1. the places drop down is not showing up on IOS, however the input text field allows me to enter a place name but the predictions list does not appear

  2. onPress handler is not triggered at all on both IOS and android

  3. The Text Input coming from react-native-google-places-autocomplete does not allow me to enter anything on ANDROID. It is like disabled all the time ( although the focus is set to true)

Note: all google location apis are enabled , google maps api, places api and geocode api are enabled and a valid api key is given.

I tried all possible solutions available including the following:

  1. setting zIndex: 1000 a high value to avoid it being hidden behind some other view

  2. Tried creating new RN App and added only this component to keep the project clean

  3. Regenerating the API and even using another api which works with previous versions of REACT NATIVE.

The logs don’t show anything on both Xcode and Android Studio. Here is the code snippet:

                 <View style = {[{zIndex: 2, backgroundColor: 'white'}]}>
				<GooglePlacesAutocomplete
					ref = {ref => setSearchTextRef(ref)}
					placeholder='Search for gym'
					styles={{
						container: {backgroundColor: 'transparent'},
						textInputContainer: styles.viewStyle,
						textInput: styles.textInputStyle,
					}}
					keyboardShouldPersistTaps = {'handled'}
					listUnderlayColor = {'transparent'}
					textInputProps = {{
						onFocus: () => focusInput(),
						onBlur: () => blurInput(),
						onChangeText: (text) => onChange(text)
					}}
					minLength={1} // minimum length of text to search
					returnKeyType={'search'}
					listViewDisplayed={'auto'}   // true/false/undefined
					fetchDetails={true}
					renderDescription={row => row.description} // custom description render
					onPress={(data, details = null) => {
						let coordinates = details.geometry.location;
						sendCoordinates(coordinates, {data, details});
					}}
					getDefaultValue={() => ''}
					query={{
						key: googleAPIKey,
						language: 'en', // language of the results
						// types: '(cities)' // default: 'geocode'
					}}
					nearbyPlacesAPI='GooglePlacesSearch' // Which API to use: GoogleReverseGeocoding or GooglePlacesSearch
					GooglePlacesSearchQuery={{
						rankby: 'distance',
						types: 'gym'
					}}
					filterReverseGeocodingByTypes={['locality', 'administrative_area_level_3']} 
					debounce={200}
				/>
			</View>

Thank you in advance

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:4
  • Comments:16

github_iconTop GitHub Comments

9reactions
bell-stevencommented, May 22, 2020

I can’t reproduce this, so i’m going to close this. If you encounter this, and this is still a problem for you, please open a new issue (please follow the issue template).

8reactions
devfilskcommented, Apr 23, 2020

Hi guys. I had the same issue with this lib, and after trying for hours, I found a solution. The problem was in the billing configuration on the google APIs. Try to configure the project where you are using key and activate billings configurations, it solved my problem. Please let me know if it works for you.

P.S. I hope this can help you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

react-native-google-places-autocomplete not working
react-native-google-places-autocomplete is not working, I am facing multiple issues 1. the places drop down is not showing up 2.
Read more >
react-native-google-places-autocomplete - npm
Start using react-native-google-places-autocomplete in your project by running `npm i react-native-google-places-autocomplete`.
Read more >
react-native-google-places-autocomplete not working on ...
Coding example for the question react-native-google-places-autocomplete not working on React native 0.61.
Read more >
react-native-google-places-autocomplete - Bountysource
41 Issues ($0.0) ... Created 3 years ago in FaridSafi/react-native-google-places-autocomplete with 2 comments. I have added in the currentLocation prop to ...
Read more >
How to use google-places-autocomplete in react native
Now need to link google-places-autocomplete plugin(if your version is below 0.61). react-native link react-native-google-places-autocomplete ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found