gpt4 book ai didi

android - getZoom 和 getVisibleBounds 方法永远不会在 @mapbox/react-native-mapbox-gl Android 中解析

转载 作者:太空宇宙 更新时间:2023-11-03 10:33:44 24 4
gpt4 key购买 nike

问题

使用 this.map refereance @mapbox/react-native-mapbox-gl npm 模块获取 mapbox 边界坐标时出现问题。我使用了 getVisibleBounds() 方法,但它无论如何都不会解析 promise。

try {
let bounds = await this.map.getVisibleBounds();

console.log("Bounds : ", bounds);
} catch (err) {
console.log("Error : ", err);
}

我在 Android 的 React-Native App 中使用了以下依赖项。

"@mapbox/react-native-mapbox-gl": "6.1.2-beta2"

"react": "16.3.1"

"react-native": "0.55.4"

既不会打印 Bounds 也不会打印 Error

请帮我解决这个问题

gitgub mapbox repo 上也有 issue raise,但他们也没有回复这个问题。您可以查看以下链接了解更多详情。

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 > Rebuild。

似乎有些事件在调试过程中被杀死,请在此处查看 mapbox 问题:

https://github.com/mapbox/react-native-mapbox-gl/issues/1189

关于android - getZoom 和 getVisibleBounds 方法永远不会在 @mapbox/react-native-mapbox-gl Android 中解析,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52402752/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com