requestOptions seems to get ignored
See original GitHub issueBug Report
Describe the Bug
passing the requestOptions doesn’t seem to work. Looking at the google doc https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#AutocompletionRequest it should be possible to restrict results from an specific country by passing the property componentRestrictions.country with the country code. found here https://developers.google.com/maps/documentation/javascript/reference/places-autocomplete-service#ComponentRestrictions
I’m pretty new with react so maybe this isn’t bug but maybe I have done something wrong in my code.
How to Reproduce
inside requestOptions, simply put
componentRestrictions: {
country: 'sv'
}
CodeSandbox Link
https://codesandbox.io/s/useplacesautocomplete-x-reach-ui-forked-qo84h in the same demo as you already have. Look at line 25 in this forked sandbox
Expected Behavior
I expect this code to only show results from the country SV (sweden)
componentRestrictions: {
country: 'sv'
}
Your Environment
- Device: [e.g. MacBook Pro, iPhone12]
- OS: [Windows]
- Browser: [Chrome]
- Version: [88.0]
I really like this! Except from this it works grate in my app! If this is not a bug, I would really appreciate help to get it to work !
Issue Analytics
- State:
- Created 3 years ago
- Comments:5 (3 by maintainers)
Top GitHub Comments
@wellyshen Hello again! Thank you! clearing the data cache along with
componentRestrictions: { country: 'se' }
worked like a charm! for some reason the gecoding feature is returning “cannot read lat of undefined” now instead haha. I will see if I can find out the problem…Thanks again for your help!
@imprex92 Nice keep going man.