Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getZoom and getVisibleBounds never resolve on Android #1353

Open
olup opened this issue Sep 4, 2018 · 8 comments
Open

getZoom and getVisibleBounds never resolve on Android #1353

olup opened this issue Sep 4, 2018 · 8 comments

Comments

@olup
Copy link

olup commented Sep 4, 2018

Calling this.map.getZoom() and this.map.getVisibleBounds() never resolve to the values requested. The map object is ok, the function call works allright but it just hang and never resolve. It doesn't throw either.

On Android.

deps :
"@mapbox/react-native-mapbox-gl": "^6.1.3",
"react": "16.3.1",
"react-native": "~0.55.2",

Any leads ?


Note : This comportement only appear when my app is connected to development server

@Jaydipsinhv
Copy link

Any update on this ticket. I am facing same problem.
I used deps as below

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

Please suggestion any work around if possible.

@Jaydipsinhv
Copy link

Okay, i have got some help from stackoverflow. there is some problem in mapbox library itself. I can see some log related with bounds with command abd logcat as below

09-19 16:58:30.049 5536 5536 W unknown:ReactNative: Calling JS function after bridge has been destroyed: RCTEventEmitter.receiveEvent([297,"rct.mapbox.map.androidcallback",{"payload":{"visibleBounds":[[-0.15595117621660393,5.732507427397039],[-0.18685022376507732,5.683997346220991]]},"type":"1537356500877"}])
09-19 16:58:30.050 5536 5536 W unknown:ReactNative: Calling JS function after bridge has been destroyed: RCTEventEmitter.receiveEvent([297,"rct.mapbox.map.change",{"payload":{},"type":"didfinishrenderingmapfully"}])
09-19 16:58:30.051 5536 5536 W unknown:ReactNative: Calling JS function after bridge has been destroyed: RCTEventEmitter.receiveEvent([297,"rct.mapbox.map.change",{"payload":{},"type":"didfinishloadingmap"}])

So when we create apk with this code it will work fine. but not working with debug mode which create big problem for implementation of further work.

You can review stackoverflow link that question i have asked.

https://stackoverflow.com/questions/52402752/getzoom-and-getvisiblebounds-methods-never-resolve-in-mapbox-react-native-mapbo

Can we get quick solution with debugging mode too?
Thanks in Advance for Help

@huyansheng3
Copy link

huyansheng3 commented Oct 23, 2018

i met the same problem ,the production environment do not work too. is there any solution?

@afshin-hoseini
Copy link

In my case this method doesn't work. It never returns any response.

@onitzschke
Copy link
Collaborator

I can't confirm it. In my cases this is woking fine.
getVisibleBounds() returns an Promise, did you await it?

  private async onRegionDidChange(regionFeature: IRegionFeature) {
    if (this.map !== null) {
      const currentBounds = await this.map.getVisibleBounds();
      if (
        currentBounds[0][0] > MapUtils.getNorthEastBoundsCoordinates()[0] ||
        currentBounds[0][1] > MapUtils.getNorthEastBoundsCoordinates()[1] ||
        currentBounds[1][0] < MapUtils.getSouthWestBoundsCoordinates()[0] ||
        currentBounds[1][1] < MapUtils.getSouthWestBoundsCoordinates()[1]
      ) {
        await this.map.moveTo(this.state.currentPosition, 500);
      }
    }
  }

@nitaliano can be closed.

@NathanNovak
Copy link

getVisibleBounds() is only working when in debug mode. when I switch off the debug connection the app freezes when it hits this._map.getVisibleBounds().

@onitzschke
Copy link
Collaborator

As you can see in the code above i have no problems. It's tested in debug and release builds.

@afshin-hoseini
Copy link

When I debug native code, everything works well, but as soon as I stop the debugger, and re-run the application, the module functions don't resolve.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants