react-places-autocomplete icon indicating copy to clipboard operation
react-places-autocomplete copied to clipboard

Not able to select suggestions by clicking (only tab works) react-places-autocomplete

Open Sithu-Soe opened this issue 2 years ago • 6 comments

When i use with phone browser, can't even select with clicking. In Computer browser only work with tab.

`import React, { useState } from 'react'; import PlacesAutocomplete, { geocodeByAddress, getLatLng, } from 'react-places-autocomplete';

const LocationSearchInput = () => { const [address, setAddress] = useState(''); const [coordinates, setCoordinates] = useState({ lat: null, lng: null }); const handleSelect = async value => { const results = await geocodeByAddress(value); const latLng = await getLatLng(results[0]) setAddress(value); setCoordinates(latLng) } return ( <PlacesAutocomplete value={this.state.address} onChange={setAddress} onSelect={handleSelect} > {({ getInputProps, suggestions, getSuggestionItemProps, loading }) => (

<input {...getInputProps({ placeholder: 'Search Places ...', className: 'location-search-input', })} /> <div className="autocomplete-dropdown-container"> {loading &&
Loading...
} {suggestions.map(suggestion => { const className = suggestion.active ? 'suggestion-item--active' : 'suggestion-item'; // inline style for demonstration purpose const style = suggestion.active ? { backgroundColor: '#fafafa', cursor: 'pointer' } : { backgroundColor: '#ffffff', cursor: 'pointer' }; return ( <div {...getSuggestionItemProps(suggestion, { className, style, })} > {suggestion.description}
); })} )} </PlacesAutocomplete> );

}`

Sithu-Soe avatar Aug 17 '21 15:08 Sithu-Soe

+1. I'm also experiencing that clicking a suggestion doesn't change input value. In my case I'm using PlacesAutocomplete as a child with a react-leaflet control

lowlyocean avatar Sep 03 '21 21:09 lowlyocean

also having this issue. clicking doesn't set the input value to the new address, only arrow keys and enter work

ErinStearns avatar Sep 22 '21 16:09 ErinStearns

+1. Is there any alternate workaround to this?

SasiKumar-Ramesh avatar Jan 12 '22 08:01 SasiKumar-Ramesh

+1. Is there any alternate workaround to this?

Might have some luck trying something like this, YMMV

lowlyocean avatar Jan 12 '22 14:01 lowlyocean

any fixes?

GaneshSinghPapola avatar Feb 22 '23 12:02 GaneshSinghPapola

any fixes?

joao-salgado avatar Mar 23 '23 16:03 joao-salgado