can't see any effect of GooglePlacesSearchQuery param.
I am having the same problem.
hmm ya all the sudden my code that was working no longer works. even in previous versions of the app on testflight locations are no longer being listed. so google must have changed something? (it seems that typing in the search box is not actually calling the search function) (EDIT: SOLVED SEE COMMENTS BELOW)
Is there a way to explicitly call the search function? This is what I've got and it's definitely not working.
minLength={2} // minimum length of text to search
autoFocus={true}
returnKeyType={'search'} // Can be left out for default return key
listViewDisplayed={true} // true/false/undefined
fetchDetails={true}
styles={style}
keyboardShouldPersistTaps="handled"
onPress={(data, details = null) => { // 'details' is provided when fetchDetails = true
props.notifyChange(details.geometry.location);
console.log('data')
console.log(data);
console.log('details')
console.log(details);
}}
query={{
key: API_KEY,
language: 'en',
components: 'country:us',
radius: 5000,
// types: '(cities)' // default: 'geocode'
}}
renderDescription={row =>
row.description || row.formatted_address || row.name
}
getDefaultValue={() => {
return props.value ? props.value : '';
}}
nearbyPlacesAPI='GooglePlacesSearch'
GooglePlacesSearchQuery={{
rankby: 'distance',
type: 'address'
}}
GooglePlacesDetailsQuery={{
fields: 'name,geometry,formatted_address'
}}
debounce={300}
/>
It's not working for me either. Try this one: https://github.com/jaing/react-native-places-input
@RyanPapazoglou there is no explicit way to call it that I know of besides typing in the input. But actually typing in the input is working for me. The real issue I discovered is I am getting this response.
By using console.log(request.responseText);
I get this:
"error_message" : "This API project is not authorized to use this API.",
"predictions" : [],
"status" : "REQUEST_DENIED"
@nescroft Hmm.. I've actually seen that before on some other related issue posts. I believe it might be due to having restrictions enabled on your API key. I will check to see if I can find the post I saw that on. Worth looking around tho.
I haven't logged my response yet, I'll see if I get the same.
@nescroft How are you actually logging the response? Would you be able to share a snippet of that section of your code?
@RyanPapazoglou yep solved it. I had to switch to a new API key because the old dev blocked the one I was using I guess. But I forgot to enable the "Places API".. once I did that it started working again.
"How are you actually logging the response? Would you be able to share a snippet of that section of your code?"
You have to go into node_modules/react-native-google-places-autocomplete then inside GooglePlacesAutocomplete.js in the _request function do console.log(request.responseText)
If you are getting good data then you might have a display issue with your styling or something.
@nescroft Awesome, thanks so much. Glad to hear you got it working!
Edit: Yea same thing, had to update the API key. They should have an option to log the reponseText by default without having to edit the package contents yourself.
Looks like this might have been resolved. Please open a new issue if this is still a problem.
Most helpful comment
@RyanPapazoglou yep solved it. I had to switch to a new API key because the old dev blocked the one I was using I guess. But I forgot to enable the "Places API".. once I did that it started working again.
"How are you actually logging the response? Would you be able to share a snippet of that section of your code?"
You have to go into node_modules/react-native-google-places-autocomplete then inside GooglePlacesAutocomplete.js in the _request function do console.log(request.responseText)
If you are getting good data then you might have a display issue with your styling or something.