ErrorPro / react-google-autocomplete

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

Only show place name instead of full address #124

Closed dmitriy1867 closed 3 years ago

dmitriy1867 commented 3 years ago

I'd like to show place name instead of the full address in an inputbox. However, when I select an address from the list of the places, it shows the full address firstly and then replaces the place name. Isn't there a way to disable selecting the full address?

Here is a video record to show how it works. http://cloud.movavi.com/show/f5iZzxlv48ydTe3bcVnNDtS6OEuBpIGW

<Autocomplete onPlaceSelected={(place, inputRef) => { inputRef.value = place.name }} />

ErrorPro commented 3 years ago

@ninjadev220 Hey, the autocomplete service has functionality out of the box which cannot be changed. The same applies to the value. What happens is you set the ref input value of the autocompelte service and then google overwrites it back. If you want to have custom behaviour/appearance u'd better try places service. That one can be customized as you wish