🐛 [BUG]
ThorSmallice opened this issue · 1 comments
ThorSmallice commented
https://codesandbox.io/embed/cocky-gould-3hwt54?fontsize=14&hidenavigation=1&theme=dark
<LarkMap {...config} style={{ height: "100vh" }}>
<IconImageLayer id="IconImageLayer" name="信访点" {...options} source={source} />
<LayerSwitchControl
layers={['IconImageLayer']}
position="bottomleft"
popperPlacement="right-end"
/>
只用了一个LayerSwitchControl组件 ,地图上却显示了两个图层控制按钮
"@antv/l7": "^2.15.3",
"@antv/larkmap": "^1.3.5",
lvisei commented
- react 小于 18 下没有问题:https://codesandbox.io/s/brave-architecture-xg8xoq?file=/src/index.tsx
- 大于 18 + StrictMode 确实有问题 https://codesandbox.io/s/dry-butterfly-q98fyb?file=/src/App.tsx
StrictMode 下父组件挂载两次导致
control useState 改 ref ?? cc @heiyexing