Skip to content

Does not work with material ui Input field #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
arualana opened this issue May 8, 2024 · 1 comment
Open

Does not work with material ui Input field #235

arualana opened this issue May 8, 2024 · 1 comment

Comments

@arualana
Copy link

arualana commented May 8, 2024

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

@thomasters17
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants