Skip to content
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

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

Open
ErickSorto opened this issue Dec 4, 2024 · 4 comments

Comments

@ErickSorto
Copy link

ErickSorto commented Dec 4, 2024

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

@skydoves
Copy link
Owner

skydoves commented Dec 4, 2024

That looks weird. Pokedex-Compose project also uses it with the shared element transition animation but it works as expected 🤔

@ErickSorto
Copy link
Author

ErickSorto commented Dec 4, 2024

That looks weird. Pokedex-Compose project also uses it with the shared element transition animation but it works as expected 🤔

After testing the Pokedex app, the issue persists. The same issue is found in Pokedex-Compose, but it is subtle.
The Pokemon disappears for half a second before the transition begins. It isn't a device issue because if you look at the GIFs in Pokedex-Compose repositories showing the transitions you can also see it disappear.

Just like this example in my app:
https://github.com/user-attachments/assets/ed602a25-c3cd-4c48-ac69-79cca6b70f16

Pokedex transition bug example:
https://github.com/user-attachments/assets/962373ba-e4aa-4d93-83f7-b79c6ec0adfa

@skydoves
Copy link
Owner

skydoves commented Dec 5, 2024

Hey @ErickSorto, do you mean the problem is image flickering?

@ErickSorto
Copy link
Author

ErickSorto commented Dec 5, 2024

Hey @ErickSorto, do you mean the problem is image flickering?

Yeah the image flickers using CoilImage but when I use a regular AsynImage it does not flicker.

This is how it looks normally:
https://github.com/user-attachments/assets/c8c83888-fe1a-41d3-a869-9c3403cbea05

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

No branches or pull requests

2 participants