问题
使用this.map参考@mapbox/react-native-mapbox-gl
npm模块获取地图框边界坐标时出现的问题。我用过getVisibleBounds()
方法,但是它不能解决任何问题。
try {
let bounds = await this.map.getVisibleBounds();
console.log("Bounds : ", bounds);
} catch (err) {
console.log("Error : ", err);
}
我在Android的React-Native App下面使用了dependecy。
"@mapbox/react-native-mapbox-gl": "6.1.2-beta2"
"react": "16.3.1"
"react-native": "0.55.4"
它既不会打印边界也不会错误
任何请帮我解决这个问题
gitgub mapbox存储库也有问题,但他们也没有对此问题进行回复。您可以在下面的链接上查看更多详细信息。
这可能不是问题,但是,您是否在Android Studio的logcat控制台中找到了?
09-19 11:15:01.070 5390-5390/com.endurance W/unknown:ReactNative: Calling JS function after bridge has been destroyed: RCTEventEmitter.receiveEvent([913,"rct.mapbox.map.androidcallback",{"payload":{"visibleBounds":[[-121.96388609239466,37.47651057926733],[-122.2038196399402,37.36744637395246]]},"type":"1537352098529"}])
Calling JS function after bridge has been destroyed: RCTEventEmitter.receiveEvent([913,"rct.mapbox.map.change",{"payload":{},"type":"didfinishrenderingmapfully"}])
Calling JS function after bridge has been destroyed: RCTEventEmitter.receiveEvent([913,"rct.mapbox.map.change",{"payload":{},"type":"didfinishloadingmap"}])
似乎在桥梁被破坏后会发出事件。如果要调试,请尝试关闭调试器控制台(React Native Debugger),禁用“实时重新加载/热重新加载”>“重建”。
似乎某些事件在调试过程中被杀死,请参见此处的mapbox问题:
https://github.com/mapbox/react-native-mapbox-gl/issues/1189
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句