Skip to content
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

Get result suggestions in countries only #369

Open
sulman2 opened this issue May 14, 2021 · 2 comments
Open

Get result suggestions in countries only #369

sulman2 opened this issue May 14, 2021 · 2 comments

Comments

@sulman2
Copy link

sulman2 commented May 14, 2021

Feature request

I can't search for countries

I should be able to add country as searchOption Types and get result in countries level.

I want the results in countries like if i put cities option then i get cities level suggestions but there is no option for countries or i might be doing wrong. i have checked the places api documentation but couldn't do anything

    if (streetAddress) {
      return ["address"];
    } else if (country) {
      return ["country"]; // Have also tried 1. 'country' 2. '(country)' 3. ['locality','country'] and ['countries'] etc
    } else {
      return ["(cities)"];
    }
  };
  const searchOptions = {
    types: checkType(),
  };```
@williamtan2251
Copy link

try this?

<PlacesAutocomplete
  searchOptions={{
    componentRestrictions: {
       country: 'US'
    }
  }}
/>

@proshoumma
Copy link

proshoumma commented Jun 25, 2021

@williamtan2251 works perfectly, thank you! 👌🏼

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

3 participants