react-google-autocomplete
react-google-autocomplete copied to clipboard
Does not work with material ui Input field
Docs say:
<AutoComplete
apiKey={YOUR_GOOGLE_MAPS_API_KEY}
onPlaceSelected={(place) => console.log(place)}
/>
or
const { ref } = usePlacesWidget({
apiKey: YOUR_GOOGLE_MAPS_API_KEY,
onPlaceSelected: (place) => console.log(place)
})
<AnyInput ref={ref} />
Using
const {ref} = usePlacesWidget({
apiKey: YOUR_GOOGLE_MAPS_API_KEY,
onPlaceSelected: (place) => {
console.log(place);
},
});
<Input
ref={ref}
/>
the search doesn't even get performed
Did you ever find a fix? It works if you put <script async src={https://maps.googleapis.com/maps/api/js?key=${process.env.REACT_APP_GOOGLE}&libraries=places&callback=Function.prototype}/> in the head but the docs suggest you no longer need to do that.