Reputation: 115
Problem
Issue while getting mapbox bounds coordinates using this.map refereance @mapbox/react-native-mapbox-gl
npm module. I used getVisibleBounds()
method but it will not resolve promise any how.
try {
let bounds = await this.map.getVisibleBounds();
console.log("Bounds : ", bounds);
} catch (err) {
console.log("Error : ", err);
}
I used below dependecy for React-Native App with Android.
"@mapbox/react-native-mapbox-gl": "6.1.2-beta2"
"react": "16.3.1"
"react-native": "0.55.4"
It will neither print Bounds nor Error
Any please help me solve out this problem
There is issue raise on gitgub mapbox repo as well but they also didn't reply on this issue. You can check on below link for more details.
Reported same issue on Github too
Upvotes: 4
Views: 1170
Reputation: 3914
This may not be the issue, but, are you getting this in your logcat console in your Android Studio?
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"}])
It seems that event is emitted after the bridge has been destroyed. If you are debugging, try to close your debugger console (React Native Debugger), disable Live Reload/Hot Reload > Rebuild.
It seems that some events are killed in debug process, see mapbox issue here:
https://github.com/mapbox/react-native-mapbox-gl/issues/1189
Upvotes: 1