Assigned
Status Update
Comments
ae...@gmail.com <ae...@gmail.com> #2
Can you try with the latest snapshot? Not reproducible for me on androidx-main.
ti...@google.com <ti...@google.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: 1.7.0-beta06 Jetpack Compose component used: AnimatedVisibility Android Studio Build: Android Studio Ladybug | 2024.1.3 Canary 3 | #AI-241.18034.62.2413.12138059, built on July 25, 2024 Kotlin version: 2.0.0
Here is the test simple:
If you look at the stack trace you can see that
AnimatedVisibility(false)
does a lot of work. Most of the timeandroidx.compose.animation.core.TransitionKt.updateTransition
andandroidx.compose.animation.AnimatedVisibilityKt.AnimatedVisibilityImpl
.Why do I pay attention to this? Google documentation says that
AnimatedVisibility
is an analogue ofif
, but the behavior I see does not correspond to this at all.With
if(false)
there will be nothing inside and it will not take time either. But withAnimatedVisibility(false)
a huge amount of work is done, comparable to the fact that the animation is already running.This seems broken to me. Please fix the behavior so that
AnimatedVisibility(false)
does not do the job and thus does not affect performance.