问题
使用this.map refereance @mapbox/react-native-mapbox-gl npm模块获取mapbox边界坐标时出现问题。我使用了getVisibleBounds()方法,但它不会以任何方式解析承诺。
try {
let bounds = await this.map.getVisibleBounds();
console.log("Bounds : ", bounds);
} catch (err) {
console.log("Error : ", err);
}
我使用下面的依赖为React本地应用程序与Android。
"@mapbox/react-native-mapbox-gl": "6.1.2-beta2"
"react": "16.3.1"
"react-native": "0.55.4"它既不会打印边界,也不会出错。
请帮我解决这个问题。
在gitgub mapbox回购上也存在问题,但他们也没有回答这个问题。有关更多细节,您可以查看下面的链接。
发布于 2018-09-19 10:20:37
这可能不是问题所在,但是,这是在Android的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"}])这座桥被毁后,似乎就发出了这样的声音。如果正在调试,请尝试关闭调试器控制台(响应本机调试器),禁用Live /Hot>重新构建。
似乎有些事件在调试过程中被终止,请参见此处的mapbox问题:
https://github.com/mapbox/react-native-mapbox-gl/issues/1189
https://stackoverflow.com/questions/52402752
复制相似问题