React-native-google-places-autocomplete: How to use componentRestrictions

Created on 21 Dec 2017  Â·  5Comments  Â·  Source: FaridSafi/react-native-google-places-autocomplete

I am trying to restrict the autocomplete results to Australia only but I can't figure out how to do this ... Where should I pass componentRestrictions ... or there is some other function in the GooglePlacesAutocomplete API ?

Most helpful comment

Example:

Limit country to Argentina

            components: 'country:ar'

All 5 comments

Check out the options that GooglePlacesAutocomplete API has for search restriction, it is specified as a comment in example.js:

query={{
          // available options: https://developers.google.com/places/web-service/autocomplete
          key: 'YOUR API KEY',
          language: 'en', // language of the results
          types: '(cities)', // default: 'geocode'
        }}

Example:

Limit country to Argentina

            components: 'country:ar'

What about multiple countries?

How about restrict for country and state Eg : I need to filter only US and Los Angeles data only . @blacktea @sagomezza

Found my answer: components:’country:ca|country:uk’

Was this page helpful?
0 / 5 - 0 ratings

Related issues

miguel-pm picture miguel-pm  Â·  3Comments

diegothucao picture diegothucao  Â·  3Comments

biks152207 picture biks152207  Â·  4Comments

DennisMuchiri picture DennisMuchiri  Â·  4Comments

tgreco picture tgreco  Â·  3Comments