Repository navigation
Conversation
Add optional animateCameraPosition and cameraAnimationDurationMs params to Map so cameraPosition updates can use native animated transitions instead of always jumping instantly. Fixes software-mansion#168. Co-authored-by: Cursor <cursoragent@cursor.com>
Consumers often pulse cameraPosition for a single frame. Keying LaunchedEffect on that prop cancelled animate() when it became null. Use snapshotFlow + collectLatest so nulling does not abort the transition. Co-authored-by: Cursor <cursoragent@cursor.com>
snapshotFlow inside LaunchedEffect(mapLoaded) was capturing a stale (null) cameraPosition from first composition, so later programmatic moves never applied. Also bridge Google Maps iOS animate APIs across Utils vs Maps GMSMapView types so iosArm64 compiles. Co-authored-by: Cursor <cursoragent@cursor.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
animateCameraPosition(defaultfalse) andcameraAnimationDurationMs(default300) toMapso programmaticcameraPositionupdates can animate instead of jumping.CameraPositionState.animate(update, durationMs)when enabled; otherwise keepsmove. ObservescameraPositionviasnapshotFlow+rememberUpdatedStateso ephemeral one-shot targets (and updates after map load) are not dropped, and clearing the prop does not cancel an in-flight animate.setRegion(..., animated = true)for subsequent updates (initial factory setup stays instant). Duration is ignored (MapKit only exposes a boolean).animateWithCameraUpdate/animateToCameraPositionwithCATransactionduration when enabled.Fixes #168.
Supersedes #179 (closed after local validation; this branch includes the post-validation Android/
rememberUpdatedStatefix).Test plan
animateCameraPosition = trueand confirm smooth pan/zoom on Android and iOS (Apple Maps + Google Maps).animateCameraPosition = false) still jumps instantly (backward compatible).CameraPositionanimates correctly on Android and Google Maps iOS.cameraPositionpulses still complete animate on Android (my-location / cluster framing style).Made with Cursor