I am using animations to show and hide a screen with Jetpack Compose. I have a screen that slides in from the right when it is made visible and then slide it back to the right when the screen is hidden.
Jetpack Compose animations recompose their content both when making the composable visible and invisible.
On the screen that is being animated, I have an Image and use rememberImagePainter and crossfade is set to false.
When the screen is made visible, the image is loaded from the network and is displayed as expected. But when the screen is made invisible by animating off to the right, the image will temporarily flash as the screen is being recomposed.
It is difficult to say what the problem is. It is clear that Jetpack Compose is recomposig the screen and therefore rememberImagePainter is being called again. But why the flashing? If Coil already has loaded the image, why is it not just reloaded from cache without the flash?
I am using animations to show and hide a screen with Jetpack Compose. I have a screen that slides in from the right when it is made visible and then slide it back to the right when the screen is hidden.
Jetpack Compose animations recompose their content both when making the composable visible and invisible.
On the screen that is being animated, I have an Image and use rememberImagePainter and crossfade is set to false.
When the screen is made visible, the image is loaded from the network and is displayed as expected. But when the screen is made invisible by animating off to the right, the image will temporarily flash as the screen is being recomposed.
It is difficult to say what the problem is. It is clear that Jetpack Compose is recomposig the screen and therefore rememberImagePainter is being called again. But why the flashing? If Coil already has loaded the image, why is it not just reloaded from cache without the flash?