Chris Johnson
06/29/2021, 4:12 PMAnimatedVisibility
have a finished listener? I know it has MutableTransitionState
where you can check if all the animations are done via isIdle
but I guess I'm looking for an example of when to use that check. I assume it wouldn't be inside the AnimatedVisibility
content composable and outside of it would make it get hit on every recomposition if I'm remembering the MutableTransitionState
Andrew Neal
06/29/2021, 5:15 PMDoeshttps://kotlinlang.slack.com/archives/CJLTWPH7S/p1619066721359200?thread_ts=1619032588.327500&cid=CJLTWPH7Shave a finished listener?AnimatedVisibility
I know it hashttps://cs.android.com/androidx/platform/tools/dokka-devsite-plugin/+/master:testData/compose/samples/animation/samples/AnimatedVisibilitySamples.kt A few sample show it being used withwhere you can check if all the animations are done viaMutableTransitionState
I guess I'm looking for an example of when to use that checkisIdle
AnimatedVisibility
.Chris Johnson
06/29/2021, 5:39 PMDisposableEffect
and the next link actually will help me solve an issue I was having with LazyColumn 😄Doris Liu
06/29/2021, 10:22 PMDisposableEffect
and MutableTransitionState
are both good ways to get the signal for when the animation has finished. The latter also gives you the info on when the enter animation has finished.
One way to use MutableTransitionState
is to set up a snapshotFlow
, so you can observe when the initial/target state has changed. Here's an example: https://cs.android.com/androidx/platform/tools/dokka-devsite-plugin/+/master:testDat[…]/samples/animation/samples/AnimatedVisibilitySamples.kt;l=613