nitaliano / react-native-mapbox-gl

A Mapbox GL react native module for creating custom maps
Other
2.16k stars 697 forks source link

MapView onRegionDidChange event not firing @ 6.1.2 & react-native@0.55.4 #1400

Closed Jaydipsinhv closed 5 years ago

Jaydipsinhv commented 6 years ago

Problem

I have added onRegionDidChange property on MapboxGL.MapView. So when I change pan on may and zoom In/Out on map this method is called. Its perfectly working fine with Android device but somehow its not working with iOS devices.

<MapboxGL.MapView key = {"mapId"} ref={map => { this.map = map }} textureMode = {true} zoomLevel={this.props.zoomLevel} styleURL={'https://free.tilehosting.com/styles/bright/style.json?key=VJidzi1RXgsZY6MIfdAE'} centerCoordinate={this.state.centerCoordinate || this.state.origin} onPress={()=>DismissKeyboard()} onLongPress={this.onPress} attributionEnabled={false} animated={true} onRegionDidChange={this.onRegionDidChange}

Regarding versions i used for react-native app is mension below

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

react-native: 0.55.4

I have also tried with @mapbox/react-native-mapbox-gl: 6.1.3 npm version for mapbox module but still faced same problem.

I want to get visiblebound on change region of map for getting longest distance between two coordinates.

So if anyone is faced this problem then please provide help to go ahead

dorthwein commented 6 years ago

We're running into this as well - very random - just started happening.

dorthwein commented 6 years ago

@Jaydipsinhv - if there is anything wrong on android with any of the layers events will falter. So for use, in android production, we hadn't set tileSize={256} on a RasterSource. While it didn't cause a hard crash, it broke everything else relatively silently. I'd suggest removing things until you get to a working state then re-adding and debugging from there.

Also there was a known bug where certain event listeners break in dev mode when you reload the app so you maybe running into that as well.

Jaydipsinhv commented 6 years ago

@dorthwein - Thanks - I know about known bug for event not working on emulators for both Android and iOS. Problem i faced during release build. In Android its perfectly working fine as expected. It only cause problem with iOS device.

Basically this event is very important for getting radius based operations on map. So i really need solution or any patch code for getting region change event.

maxencehenneron commented 6 years ago

I created an issue for this #1391

maxencehenneron commented 6 years ago

https://github.com/mapbox/react-native-mapbox-gl/commit/8bfa736f5a3350c59e96b778f8e54391262fabd0 This may be the commit creating this bug

seeya commented 5 years ago

I was on mapbox@6.1.2 and react-native@0.57.1 and faced the issue of not having events firing on only Android. Once I updated to mapbox@6.1.3 the events started working. I checked the commits, it seem like they fixed it in the latest version.

karlguillotte commented 5 years ago

I was on mapbox@6.1.2 and react-native@0.57.0 and faced the issue of not having events firing on only Android. mapbox@6.1.3 did not fix the issue. Reverting back to mapbox@6.1.1 worked.

RichardLindhout commented 5 years ago

For me it was reloading the app as @dorthwein said!

onitzschke commented 5 years ago

@nitaliano it's not an issue. Maybe they hot relaod their app.

RichardLindhout commented 5 years ago

It is an issue however it resolves itself in production and the first time you load the app after compiling. (Android)

RichardLindhout commented 5 years ago

The second time you reload the app it does not work.

kristfal commented 5 years ago

This is fixed in master.

parkdcom commented 5 years ago

I seem to be hitting this issue again even on master. 6.1.1 is fine but anything above that (even master) do not) fire the events.

Using RN version 0.59.4

0radek commented 4 years ago

I am using this lib's version 8.1.0-rc.2 and RN version 0.62.2, and also noticing that the onRegionDidChange does not seem to always fire. If I continously move the map around (swiping the map a few times), it does not always fire.