-
Notifications
You must be signed in to change notification settings - Fork 9
expected mapDiv of type Element but was passed null #10
Comments
Doesn't happen on 1.2.1, only on 1.2.2 |
facing the same issue. Have you got any solution for it? |
I forced it to use version 1.2.1, meanwhile I started using tomchentw's react-google-maps instead. His Marker component has a draggable prop and onDragEnd returns coordinates, which is basically all I need on my use case. |
Ok Lucas, will take a look. will appreciate it if I get a working code block for it. If you don't mind, kindly share it |
Not the cleanest example but should give you a good starting point. Don't forget to add a key on the bottom for google maps.
|
Thank you so much Lucas |
I'm having the same problem however it works fine for me in 1 part of my application and not in another. The difference being it works on where I show the map in a Modal Dialog, so it's not initially visible, perhaps this is something to do with the problem ? The place where I just show it immediately on a page is failing as above. |
The solution for this error just use setTimeout function `// ** React Imports const MapPickerLocation = ({handleChangeLocation, location}) => { const [show, setShow] = useState(false) useEffect(
if (!show) { Загрузка... } return ( <MapPicker defaultLocation={location} zoom={12} mapTypeId="roadmap" style={{height:'400px'}} onChangeLocation={handleChangeLocation} //onChangeZoom={handleChangeZoom} apiKey=''/> ) } export default MapPickerLocation |
@akhmadceo solution worked for me. Problem was the MapPicker would only load on a modal and give the error when not in a modal. On versions 1.2.2, 1.2.3 and 1.2.1. |
I read the code of this nice package and I found the issue. |
@akhmadceo solution worked for me, thank you |
On 1.2.2 sometimes the component returns "expected mapDiv of type Element but was passed null". Seems to be due to the 500ms timeout added on a quick glance. I managed to reproduce this passing only the style and api key parameters.
The text was updated successfully, but these errors were encountered: