React-native-mapbox-gl: [v6] onRegionDidChange fires with animated=false on every call to render()

Created on 19 Nov 2017  路  5Comments  路  Source: nitaliano/react-native-mapbox-gl

It looks like v6 did not fix the animated property issue with onRegionDidChange.

onRegionDidChange seems to fire after every call to the render() view.

I have a RE-CENTER button on the screen which works just like google maps which shows when the user drags the map, and hides and sets userTrackingMode=true when clicked.

  1. Drag the screen while in userTrackingMode=true, i use handleRegionDidChange, and check that !region.animated
  2. I set setTrackingMode=false via setState
  3. Call to render() to draw the RE-CENTER button
  4. User clicks RE-CENTER button
  5. this._map.easeTo to animate to over the user
  6. call to setState to hide the RE-CENTER button
  7. handleRegionDidChange is called again (because of the redraw) and !region.animated === true, thus re-showing the RE-CENTER button again

Most helpful comment

Hey,

I think the biggest issue here is that you guys are are trying to work around a lack APIs in the SDK. There are two underlying issues that I think needs to be resolved:

1) We need to be able to track the state of trackingMode, and the behavior of these need to be normalized across iOS and Android (#699)
2) We need to be able to track the state of the map through regionDidChanage or a similar event that also notifies if the change is user initialized or activated through other means such as geolocation updates (#697)

Until those two issues are resolved, I don't see any proper way of handing the state of user tracking as we cant use the PanResponder nor wrap the map in a touchable view since the map view will capture all touch events.

All 5 comments

I attempted to use PanResponder to try and implement my own drag-detection on the parent view, but <MapboxGL.MapView> seems to somehow override it?

That's the issue I wanted to describe in #782.

Hey,

I think the biggest issue here is that you guys are are trying to work around a lack APIs in the SDK. There are two underlying issues that I think needs to be resolved:

1) We need to be able to track the state of trackingMode, and the behavior of these need to be normalized across iOS and Android (#699)
2) We need to be able to track the state of the map through regionDidChanage or a similar event that also notifies if the change is user initialized or activated through other means such as geolocation updates (#697)

Until those two issues are resolved, I don't see any proper way of handing the state of user tracking as we cant use the PanResponder nor wrap the map in a touchable view since the map view will capture all touch events.

not the same issue, but I also want to use PanResponder
MapView in a scrollview on android behave strange when scrolling the map..event stops propagation when the way you scroll is not enough horizontal..
does anyone facing a similar problem?

Closing this out region change is now throttled to 500 ms and is not fired until the camera is idle, it's currently in master will be in 6.0.2

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yaduc picture yaduc  路  3Comments

digitaldavenyc picture digitaldavenyc  路  4Comments

Maxence-Machu picture Maxence-Machu  路  3Comments

Amalp picture Amalp  路  3Comments

Gp2mv3 picture Gp2mv3  路  3Comments