加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

getZoom和getVisibleBounds方法永远不会在@ mapbox / react-nati

发布时间:2020-12-15 16:15:41 所属栏目:百科 来源:网络整理
导读:问题 使用this.map refereance @ mapbox / react-native-mapbox-gl npm模块获取mapbox bounds坐标时出现问题.我使用了getVisibleBounds()方法,但它不会如何解决promise. try { let bounds = await this.map.getVisibleBounds(); console.log("Bounds : ",bou
问题

使用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,"type":"didfinishloadingmap"}])

似乎事件是在桥被破坏后发出的.如果您正在调试,请尝试关闭调试器控制台(React Native Debugger),禁用Live Reload / Hot Reload>重建.

似乎某些事件在调试过程中被杀死,请参阅mapbox问题:

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读