react-google-maps-api
react-google-maps-api copied to clipboard
Uncaught TypeError: Cannot read properties of undefined (reading 'trim')
Issue template
Uncaught TypeError: Cannot read properties of undefined (reading 'trim') I got this error on Autocomplete input component. here's my code
import React, { useRef, useState } from 'react';
import { Autocomplete } from '@react-google-maps/api';
const AddressField = ({ label, name, placeholder, required, readOnly, initialValue }) => {
const [value, setValue] = useState(initialValue);
const addressRef = useRef();
const handelChange = () => {
if (addressRef.current !== null) {
const { formatted_address } = addressRef.current.getPlace();
setValue(formatted_address);
}
};
return (
<div>
{label ? (<p>{label}</p>) : null}
<Autocomplete onLoad={(ref) => (addressRef.current = ref)} onPlaceChanged={handelChange}>
<input name={name} placeholder={placeholder} required={required} readOnly={readOnly} value={value} />
</Autocomplete>
</div>
);
};
export default AddressField;
Your Environment
os: mac
node --latest
react version --latest
webpack version --latest
@react-google-maps/api 2.7.0
@vitalijalbu please provide minimal reproduction in codesandbox.io
sorry, will provide asap. it. was long time ago :D
@JustFly1984 can i take up this issue?