admin管理员组文章数量:1125008
So I'm following this example by visgl from this PR: .tsx
I even am using the same exact DATA_URL
that's provided in the example PR. However, it throws me an error, where it says
cannot read properties of null (reading 'fromLatLngToDivPixel')
I tried debugging this, and I found that this issue arise due to this useEffect
inside of the DeckGlOverlay
:
useEffect(() => {
deck.setMap(map);
return () => deck.setMap(null);
}, [map]);
If I comment this out, the map renders out fine, but if I try to include this useEffect
, it will throw the error above. What am I missing here?
UPDATE
The only difference I see is that: <Map
style={{ width: "85vw", height: "85vh" }}
defaultCenter={{ lat: 37.74, lng: -122.4 }}
zoom={11}
gestureHandling={"greedy"}
disableDefaultUI
>
<DeckGlOverlay layers={getDeckGlLayers(data)} />
</Map>
In my component, I'm using style
here, because if I don't set this, I won't see the map anywhere.
本文标签: javascriptUsing Google Maps API with DeckGLOverlay throws an undefined errorStack Overflow
版权声明:本文标题:javascript - Using Google Maps API with DeckGLOverlay throws an undefined error - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736654967a1946230.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论