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

getZoom and getVisibleBounds methods never resolve in @mapbox/react-native-mapbox-gl Android

问题

使用 this.map 引用 @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);
     }

我在 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,但他们也没有回复这个问题。您可以查看下方 link 了解更多详情。

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