Open zhuzhengjing opened 6 years ago
看下崩溃时的调用栈
排除法,确定问题所在:去掉History.js
中的MapView.MultiPoint
就好了。
render() {
return (
<View style={StyleSheet.absoluteFill}>
<MapView
{...this.state}
style={styles.mapView}
>
<MapView.Polyline
gradient
width={5}
colors={['#f44336', '#2196f3', '#4caf50']}
coordinates={this.state.linePoints}
/>
{/*<MapView.MultiPoint*/}
{/*points={this.state.linePoints}*/}
{/*onItemPress={this._onItemPress}*/}
{/*/>*/}
</MapView>
</View>
)
}
MapView.MultiPoint
为什么会有这样的影响呢?
不确定,能提供一个能重现的项目吗,方便直接调试
应该不是 MultiPoint
的问题,不然 example 也会有问题的,看起来是在某种情况下才会导致的。单从你提供的代码看不出来。
整理了一个最小demo,重现方法:首页点击jump跳转到第二页,随便操作地图几下,然后返回到首页,移动地图,程序崩溃。 @qiuxiang
好的,稍后看
用到的版本
package.json
用了官方的
react-navigation
,只有一个界面集成MapView
时没有问题,各种手势API调用都没有问题。我这里是
Main.js
,代码如下:后面又写了
History.js
,通过react-navigation
push了一个新实例,这里只绘制了一条路径。此时返回到Main.js
时移动地图程序就崩溃了。截图如下,真机iPhone 6 Plus,模拟器iPhone X测试结果一致。崩溃前没有任何log。Xcode断点只定位到main函数,没有参考意义。看起来是内存问题。希望能帮忙看看,谢谢!