When fetchDetails={true}, details prop of onPress should show all this information https://developers.google.com/places/web-service/search#PlaceSearchResponses.
But this is an example of what it currently shows:
```
Object {
"formatted_address": "San Francisco, C贸rdoba, Argentina",
}
Its probably because of the information being returned from Google Places Api.
Anyways you can use react-native-geocoding to get geometry using the formatted address.
I hope it helps.
When
fetchDetails={true},detailsprop ofonPressshould show all this information https://developers.google.com/places/web-service/search#PlaceSearchResponses.But this is an example of what it currently shows:
Object { "formatted_address": "San Francisco, C贸rdoba, Argentina", }
I have got the same issue!
For react-native 59.9 works fine, once I updated RN to 61.5 it is like you have
@edoantonioco remove that
...this.props.GooglePlacesDetailsQuery,
in line 289
this solve my problem
@edoantonioco you can also remove
GooglePlacesDetailsQuery from where you're using Google Places Component
GooglePlacesSearchQuery={{
rankby: 'distance',
types: 'food',
}}
// GooglePlacesDetailsQuery={{
// // available options for GooglePlacesDetails API : https://developers.google.com/places/web-service/details
// fields: 'formatted_address',
// }}
filterReverseGeocodingByTypes={[
'locality',
'administrative_area_level_3',
]}
Hope this works for u that work for me
Hey all, API google place autocomplete return this result (below), not geometry :)
{
"status": "OK",
"predictions" : [
{
"description" : "Paris, France",
"distance_meters" : 8030004,
"id" : "691b237b0322f28988f3ce03e321ff72a12167fd",
"matched_substrings" : [
{
"length" : 5,
"offset" : 0
}
],
"place_id" : "ChIJD7fiBh9u5kcRYJSMaMOCCwQ",
"reference" : "CjQlAAAA_KB6EEceSTfkteSSF6U0pvumHCoLUboRcDlAH05N1pZJLmOQbYmboEi0SwXBSoI2EhAhj249tFDCVh4R-PXZkPK8GhTBmp_6_lWljaf1joVs1SH2ttB_tw",
"terms" : [
{
"offset" : 0,
"value" : "Paris"
},
{
"offset" : 7,
"value" : "France"
}
],
"types" : [ "locality", "political", "geocode" ]
},
{
"description" : "Paris-Madrid Grocery (Spanish Table Seattle), Western Avenue, Seattle, WA, USA",
"distance_meters" : 12597,
"id" : "f4231a82cfe0633a6a32e63538e61c18277d01c0",
"matched_substrings" : [
{
"length" : 5,
"offset" : 0
}
],
"place_id" : "ChIJHcYlZ7JqkFQRlpy-6pytmPI",
"reference" : "ChIJHcYlZ7JqkFQRlpy-6pytmPI",
"structured_formatting" : {
"main_text" : "Paris-Madrid Grocery (Spanish Table Seattle)",
"main_text_matched_substrings" : [
{
"length" : 5,
"offset" : 0
}
],
"secondary_text" : "Western Avenue, Seattle, WA, USA"
},
"terms" : [
{
"offset" : 0,
"value" : "Paris-Madrid Grocery (Spanish Table Seattle)"
},
{
"offset" : 46,
"value" : "Western Avenue"
},
{
"offset" : 62,
"value" : "Seattle"
},
{
"offset" : 71,
"value" : "WA"
},
{
"offset" : 75,
"value" : "USA"
}
],
"types" : [
"grocery_or_supermarket",
"food",
"store",
"point_of_interest",
"establishment"
]
},
{
"description" : "Paris, TX, USA",
"distance_meters" : 2712292,
"id" : "518e47f3d7f39277eb3bc895cb84419c2b43b5ac",
"matched_substrings" : [
{
"length" : 5,
"offset" : 0
}
],
"place_id" : "ChIJmysnFgZYSoYRSfPTL2YJuck",
"reference" : "ChIJmysnFgZYSoYRSfPTL2YJuck",
"structured_formatting" : {
"main_text" : "Paris",
"main_text_matched_substrings" : [
{
"length" : 5,
"offset" : 0
}
],
"secondary_text" : "TX, USA"
},
"terms" : [
{
"offset" : 0,
"value" : "Paris"
},
{
"offset" : 7,
"value" : "TX"
},
{
"offset" : 11,
"value" : "USA"
}
],
"types" : [ "locality", "political", "geocode" ]
},
...additional results ...
@edoantonioco you can please provide a sample of your <GoogleAutocomplete /> component?
I just tested this using this, and I got everything back.
<GooglePlacesAutocomplete
ref={ref}
fetchDetails={true}
onPress={(data, details) => console.log(data, details)}
query={{
key: GOOGLE_PLACES_API_KEY,
language: 'en', // language of the results
}}
onFail={error => alert(error)}
/>
Are you using the GooglePlacesDetailsQuery prop?
This issue is pretty old, and it doesn't seem like i'm getting a response. I am going to close this issue. Please open a new issue (please be sure to follow the issue template) if you encounter this again.
Most helpful comment
@edoantonioco remove that
...this.props.GooglePlacesDetailsQuery,
in line 289
this solve my problem