ErrorPro / react-google-autocomplete

React components for google places API.
MIT License
476 stars 113 forks source link

❗ By default the Autocomplete suggest regions as predictions! #123

Closed Farkadi06 closed 3 years ago

Farkadi06 commented 3 years ago

When instructing the Place Autocomplete service to return only business results I got no predictions. ❗ The example :

import Autocomplete from "react-google-autocomplete";

<Autocomplete
        apiKey={API_Key}
        onPlaceSelected={(place) => console.log(place)}
        options={{
          types: ["(establishment)"]
        }}
     />
AlexeyRDKV commented 3 years ago

You must pass the types in quotes and everything will work.

options={{
      types: ["geocode", "establishment"]
   }}

Place types https://developers.google.com/maps/documentation/places/web-service/autocomplete#place_types