react-native-baidumap-sdk
react-native-baidumap-sdk copied to clipboard
想写一个根据 事件 onStatusChange 改变的标记 MapView.Marker, MapView.Marker的coordinate改变之后会触发onStatusChange,这样会一直触发onStatusChange,形成死循环
代码:
<MapView style={{width: '100%', height: '50%'}} center={this.state.ownPosition} zoomLevel={15} locationMode="follow" onStatusChange={obj => this.onStatusChange(obj)} locationEnabled > <MapView.Marker title="your own position" color="#3498db" coordinate={this.state.location} /> </MapView>
onStatusChange 事件: onStatusChange (obj) { // 滑动地图 this.setState({ location: obj.center }, () => { this.getAroundList(1) }) }
onStatusChange事件从打开时候之后触发,死循环了
你好,你解决了这个问题吗
@zhllucky iOS出现的吧?我也遇见了,你解决了么