Skip to content

com.google.maps.android.compose.GoogleMap recomposes when used alongside shared elements that use .sharedBounds() #633

Description

@iamutkarshtiwari

Please be sure to include as much information as possible:

Environment details

  1. OS type and version: Android 14
  2. Library version:
composeMapWidgets = "com.google.maps.android:maps-compose-widgets:3.1.1"
composeMapsUtils = "com.google.maps.android:maps-compose-utils:3.1.1"
composeMaps = "com.google.maps.android:maps-compose:3.1.1"

Steps to reproduce

  1. Replace the value of com.google.android.geo.API_KEY in manifest file.
  2. Run the app and tap the red box.
  3. The box should transition to a second screen and turn into a yellow box spanning whole screen width.
  4. Return back to the previous screen by swipe inwards from the left edge or by pressing back button
  5. The yellow box transitions back to its original location and transforms into the red box.
  6. Notice how the GoogleMap composable flashes and refreshes itself.
google.map.bug.mp4
Expectation

GoogleMap should not recompose or refresh itself when using shared elements transition in Compose

Minimal Repro

Here is the link to the minimal repro.
Github doesn't allow file size above 25Mb so I couldn't attach the project zip here.

I have also filed a ticket in Google bugtracker as well for the compose animation team to look into.

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority: p2Moderately-important priority. Fix may not be included in next release.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions