Skip to content

fix: fallback to moveCamera in lite mode for CameraPositionState animate#877

Merged
dkhawk merged 5 commits into
mainfrom
fix/lite-mode-camera-animation
Mar 26, 2026
Merged

fix: fallback to moveCamera in lite mode for CameraPositionState animate#877
dkhawk merged 5 commits into
mainfrom
fix/lite-mode-camera-animation

Conversation

@kikoso

@kikoso kikoso commented Mar 24, 2026

Copy link
Copy Markdown
Collaborator

Description

This PR fixes an issue where calling cameraPositionState.animate() on a GoogleMap configured in Lite Mode would suspend indefinitely because the underlying Maps SDK does not trigger animation callbacks in Lite Mode.

Changes

  • CameraPositionState/GoogleMap: Reads liteMode from the provided GoogleMapOptions and stores it internally in CameraPositionState.
  • Fallback Logic: If isLiteMode is true, performAnimateCameraLocked falls back to calling map.moveCamera() instantly and resumes the coroutine, avoiding an infinite suspension.
  • Sample App: Added a new LiteModeActivity to the sample app to showcase Lite Mode maps and specifically test this animate() fallback logic.

* Detect Lite Mode configuration from GoogleMapOptions to properly initialize the state
* Fallback to map.moveCamera() instantaneously when animate is called in Lite Mode, which avoids suspending the coroutine indefinitely since animation callbacks are not fired
* Add LiteModeActivity to the sample app to showcase the functionality and test the fallback
@kikoso kikoso requested a review from a team as a code owner March 24, 2026 06:45
@googlemaps-bot

Copy link
Copy Markdown
Contributor

Code Coverage

There is no coverage information present for the Files changed

@dkhawk dkhawk merged commit 8994e12 into main Mar 26, 2026
9 checks passed
@dkhawk dkhawk deleted the fix/lite-mode-camera-animation branch March 26, 2026 19:36
yankeppey added a commit to yankeppey/kmp-maps-compose that referenced this pull request Apr 13, 2026
…onState animate (googlemaps/android-maps-compose#877)

googlemaps/android-maps-compose@8994e123

Pending — not yet released. On Android, our CameraPositionState delegates
animate() to GoogleCameraPositionState, so this fix will be auto-inherited
when we next bump maps-compose. Lite mode is not applicable on iOS.
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

Successfully merging this pull request may close these issues.

3 participants