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.

google's getPlacePredictions doesn't cope with options as illustrated in the props doc

See original GitHub issue

In the documentation, you suggest

const options = {
  location: new google.maps.LatLng(-34, 151),
  radius: 2000,
  types: ['address']
}

<PlacesAutocomplete
  inputProps={inputProps}
  options={options}
/>

but this leads getPlacePredictions to return INVALID_REQUEST as documentation shows that the call should have an prod field and an options prop.

This was working before but I guess google’s api is more strict now. I was able to overcome the problem by now defining

const options = {
  options: {
    location: new google.maps.LatLng(-34, 151),
    radius: 2000,
    types: ['address']
  }
}

but I guess PlacesAutocomplete.js#L67 might just need to be options: this.props.options

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:12 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
diligiantcommented, Aug 6, 2017

I’m gonna get to the bottom of this…

0reactions
hibikencommented, Aug 7, 2017

@diligiant Thank you for taking a look at this 👍

Read more comments on GitHub >

github_iconTop Results From Across the Web

Google AutocompleteService getPlacePredictions is not working
Afterwards I tried multiple options: At first I tried with simple Autocomplete request to see any result. I entered the following code: let ......
Read more >
Place Autocomplete | Maps JavaScript API - Google Developers
SearchBox offers fewer options than Autocomplete for restricting the search. ... Call getPlacePredictions() to retrieve matching places, ...
Read more >
Integrating Google Places Autocomplete API in a React App
The AutocompleteService class doesn't provide any UI component. Still, it allows you to get place predictions data programmatically and display ...
Read more >
ErrorPro/react-google-autocomplete - GitHub
Is a hook that has a single config argument. It has exactly the same interface as ReactGoogleAutocomplete props. This hook is actually used...
Read more >
Google Maps JavaScript API Tutorial - YouTube
In this video I will work a little bit with the Google Maps API as requested by some of my subscribers. We will...
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