Skip to content

Shared Element Transitions in Compose not working with Landscapist Coil #620

@ErickSorto

Description

@ErickSorto

Please complete the following information:

  • Library Version 2.4.4
  • Affected Device(s) Samsung Galaxy S24

Describe the Bug:
The image fades away and then reappears on the next screen instead of a smooth transition.

Expected Behavior:
The image should smoothly transition from one screen to another.

Implementation:

CoilImage(
                imageModel = { decodedUrl },
                modifier = Modifier
                    .fillMaxWidth()
                    .aspectRatio(1f)
                    .sharedElement(
                        rememberSharedContentState(key = "image/$decodedUrl"),
                        animatedVisibilityScope = animatedVisibilityScope,
                        boundsTransform = { _, _ ->
                            tween(500)
                        }
                    ),
                component = rememberImageComponent {

                },
                imageOptions = ImageOptions(
                    contentScale = ContentScale.Crop
                ),
            )

Here is the buggy behavior:
https://github.com/user-attachments/assets/c726721e-7a7b-41ad-a8fc-ce0de6e4ebd8

Another example:
https://github.com/user-attachments/assets/ed602a25-c3cd-4c48-ac69-79cca6b70f16

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions