react-google-autocomplete icon indicating copy to clipboard operation
react-google-autocomplete copied to clipboard

Does not work with material ui Input field

Open arualana opened this issue 1 year ago • 1 comments

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

arualana avatar May 08 '24 13:05 arualana

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.

thomasters17 avatar Feb 19 '25 17:02 thomasters17