export const AddressInput = ({}) => {
const [userInput, setUserInput] = useState('');
const [dropdownOpen, setDropdownOpen] = useState(false);
const { placePredictions, getPlacePredictions, isPlacePredictionsLoading } =
usePlacesAutocomplete();
return (
{
const addressTyped = evt.target.value;
getPlacePredictions({ input: addressTyped });
setUserInput(evt.target.value);
if (addressTyped !== '') setDropdownOpen(true);
}}
/>
{!isPlacePredictionsLoading && (
{placePredictions.map((p, i) => (
setUserInput(p.description)}
>
{p.description}
))}
Edit address manually
)}
);
};
Подробнее здесь: https://stackoverflow.com/questions/772 ... ceed-input
Мобильная версия