react-google-maps icon indicating copy to clipboard operation
react-google-maps copied to clipboard

Property mapPanes is null

Open janprasil opened this issue 9 years ago • 8 comments

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

janprasil avatar Dec 13 '16 14:12 janprasil

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

janprasil avatar Dec 18 '16 21:12 janprasil

Doesn't fix it for me...

jtiscione avatar Jan 10 '17 21:01 jtiscione

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

janprasil avatar Jan 10 '17 22:01 janprasil

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

techsev avatar Jan 13 '17 21:01 techsev

Did anyone come up with any solutions?

parsadotsh avatar Mar 05 '17 08:03 parsadotsh

+1

urikphytech avatar Mar 13 '17 14:03 urikphytech

+1

eforkin avatar Mar 17 '17 22:03 eforkin

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

tomchentw avatar Apr 20 '17 06:04 tomchentw