问题
使用this.map refereance @ mapbox / react-native-mapbox-gl npm模块获取mapbox bounds坐标时出现问题.我使用了getVisibleBounds()方法,但它不会如何解决promise.
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 repo上也有问题,但他们也没有回答这个问题.您可以查看以下链接了解更多详情.
Reported same issue on Github too
最佳答案 这可能不是问题,但是,您是否在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),禁用Live Reload / Hot Reload>重建.
似乎某些事件在调试过程中被杀死,请参阅mapbox问题:
https://github.com/mapbox/react-native-mapbox-gl/issues/1189