React-google-maps: Property mapPanes is null

Created on 13 Dec 2016  路  8Comments  路  Source: tomchentw/react-google-maps

Hello,

I have a problem with overlayView - a property mapPanes becomes null when a component is rerendered (by incoming items that create new overlayViews) and i am still giving this error message:
TypeError: Cannot read property 'overlayMouseTarget' of null

from react-google-maps/lib/utils/OverlayViewHelper in mountContainerElementToPane

Here is my code:

const clusterMarkers = cluster && cluster.map((x, key) => <OverlayView
     position={{ lat: x.lat, lng: x.lng }}
     mapPaneName={OverlayView.OVERLAY_MOUSE_TARGET}
     getPixelPositionOffset={getPixelPositionOffset}
     key={key}
    >
      <div onClick={...}>
        {x.title}
      </div>
    </OverlayView>);
<GoogleMap
      ref={setMap}
      center={c}
      zoom={z}
      onZoomChanged={zoomChangedHandler}
      onDragEnd={centerChangedHandler}
>
    {clusterMarkers}
</GoogleMap>

Please, do you have any idea to fix it?

I am using v6.0.0

Most helpful comment

this solves the error messages BUT causes flickering on any setState that rerenders the map.

All 8 comments

I found the answer - the overlay key was not unique.

Doesn't fix it for me...

Add a random uuid to every key prop and change it every rerendering..

this solves the error messages BUT causes flickering on any setState that rerenders the map.

Did anyone come up with any solutions?

+1

+1

Please refer to Getting Help section in the README (or #469).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

wayofthefuture picture wayofthefuture  路  3Comments

julienvincent picture julienvincent  路  3Comments

craigcartmell picture craigcartmell  路  4Comments

madbean picture madbean  路  3Comments

MrSaints picture MrSaints  路  3Comments