react-google-autocomplete
react-google-autocomplete copied to clipboard
Cannot read properties of undefined (reading 'places')
Sometimes i get an error here.
https://github.com/ErrorPro/react-google-autocomplete/blob/master/src/usePlacesWidget.js
Cannot read properties of undefined (reading 'places')
if (!google.maps.places) return console.error("Google maps places API must be loaded.");
Notice that you can pass a callback to a script url now. It would be easier to handle everything.
<script async
src="https://maps.googleapis.com/maps/api/js?key=YOUR_API_KEY&libraries=places&callback=initMap"> // initMap is a custom window.initMap function
</script>
the issue is that if your code is inside a bundle then it's hard to get it exposed to the global scope. I'll add another check fo .maps.places
. If you have time u can create a PR with the fix and I'll merge it
I'm also encountering this issue, but I'm not sure what the problem is. Happy to create a PR, but what kind of check are you talking about?
I'm facing the same issue :)
@l-hendriks @ericdjavid hey guys, just pushed [email protected] can u try if it works for you?
Upgraded to "react-google-autocomplete": "^2.7.2",
but still encountering the same issues:
Google maps places API must be loaded.
the issue is that if your code is inside a bundle then it's hard to get it exposed to the global scope. I'll add another check fo
.maps.places
. If you have time u can create a PR with the fix and I'll merge it
Same here.
undefined is not an object (evaluating 'new google.maps.places')
iOS: 17.0 react-google-autocomplete: "2.7.3"
Is there any solution for this issue?
If the PR cannot be merged, can we fix it using patch-package
?
Same here...
but it seems that this issue only happens when the page gets fully reloaded...