Assigned
Status Update
Comments
ti...@google.com <ti...@google.com> #2
Can you try with the latest snapshot? Not reproducible for me on androidx-main.
fr...@gmail.com <fr...@gmail.com> #3
Ok, after trying a couple more versions, realized this is a duplicate of
From the release notes:
AndroidView's update callback's first invocation will now be defered until the view is attached, instead of running when the composition that introduces the AndroidView is applied. This fixes a bug where the update callback wouldn't be invalidated if a state it read was changed immediately by an effect. (Ie9438,
) b/291094055
Sorry for the confusion!
Description
Jetpack Compose version: BOM 2024.05.00
Jetpack Compose component used: AnimatedVisibility
Android Studio Build: Jellyfish 2023.3.1 Patch 1
Kotlin version: 1.9.0
Steps to Reproduce or Code Sample to Reproduce:
AnimatedVisibility reverts to using a quick default animation in several cases. Our app displays a list of timers, so our content size may change as the timer ticks, and this is causing enter and exit animations to look weird. I've worked around this for now by using a fixed height, but this seems like an underlying problem in AnimatedVisibility where its internal state is getting reset.
To trigger this behavior, do 1 of the following while an animation is in progress:
Desired Behavior
Instead of reverting to a default animation, I think it would look a lot better if AnimatedVisibility used my specified transitions instead of the default. Here's my ideal behavior for each of these cases:
1 - timeRemaining
from the current animation. So if we're 80% exited and the visible changes totrue
, start the enter animation at 20% already completed. Since enter/exit animation are usually symmetrical, I think this will probably look the best. I could also settle for running the enter animation for its full duration starting at the current position.Video and Repo
In this video, I've created 3 animated Texts using a slow animation to demonstrate the issue. The first is plain text (blue), the 2nd is a timer with fixed height (blue), and the 3rd is a timer that changes height (red). As you can see, the height-changing timer finishes its enter animation almost immediately. Then, when I toggle visibility while animation is in progress, it uses the quick default animation. I've created a running example here: