-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
[iOS] [MapView] Make the region prop only an initial region #5130
Comments
Hey jedlau, thanks for reporting this issue! React Native, as you've probably heard, is getting really popular and truth is we're getting a bit overwhelmed by the activity surrounding it. There are just too many issues for us to manage properly.
|
+1, having the same issue – if I use |
I would recommend you to use react-native-maps as it is more feature-complete than our internal implementation. |
@facebook-github-bot bugfix |
@facebook-github-bot close |
Hey @jedlau, we're a small team and rely on the community to fix issues that don't affect fb apps. If you're sure this is a bug can you send a pull request with a fix? |
@facebook-github-bot close |
@charpeni tells me to close this issue. If you think it should still be opened let us know why. |
Use case: Annotations are displayed on a map, and the initial map region is set so that all of the annotations are visible. Annotations are moving around, which triggers re-renders. In addition, the user should be able to pan/zoom around the map, so
onRegionChange
andonRegionChangeComplete
attempt to capture region changes and set those in the state; in this way, the map region doesn't reset to the initial map region whenever a re-render occurs.Problem: Setting the updated region in the state doesn't allow for a smooth panning/scrolling experience on the map, due to the delay in updating the state. After a couple of pans or zooms, the map freezes, presumably because it is using the current region saved in the state, and not a more updated region. Wait 1-2 seconds, and the map can be panned/zoomed again, presumably because the region has now been updated in the state.
Suggestion: Make the MapView's
region
prop an initial region. That way, only annotation updates trigger re-renders.onRegionChange
andonRegionChangeComplete
can then be used as delegate methods to perform work on the new region (analogous to MKMapViewDelegate'smapView:regionWillChangeAnimated:
), rather than saving the region itself for the purposes of map rendering.The text was updated successfully, but these errors were encountered: