wellyshen / use-places-autocomplete

😎 📍 React hook for Google Maps Places Autocomplete.
https://use-places-autocomplete.netlify.app
MIT License
1.25k stars 64 forks source link

TypeError: Cannot read properties of undefined (reading 'maps') at getGeocode #1092

Closed toppyc4 closed 1 year ago

toppyc4 commented 1 year ago

Bug Report

Describe the Bug

I have been try to use getGeocode but always get TypeError: Cannot read properties of undefined (reading 'maps') which pointed to getGeocode function. I try many things include your example code, which still doesn't work.

CodeSandbox Link

here my codesandbox (which have the same bug as in my app): https://codesandbox.io/p/sandbox/friendly-gauss-z0xqre?file=%2Fpages%2Findex.tsx&selection=%5B%7B%22endColumn%22%3A1%2C%22endLineNumber%22%3A17%2C%22startColumn%22%3A1%2C%22startLineNumber%22%3A17%7D%5D

and I try to use getGeocode in you codesandbox example, its log "InvalidValueError: cannot set both placeId and address": https://codesandbox.io/s/useplacesautocomplete-x-reach-ui-forked-hdc4x7?file=/src/App.tsx

Expected Behavior

expect getGeocode to return Lat Lng coordinate

Screenshots

Screenshot (53)

Your Environment