Is there any APIs for being notified about an animation being finished in
AnimatedVisibility
? (like
onFinishedListener
)
m
maciejciemiega
11/20/2021, 5:46 PM
It's not a listener, but you can react to transition state. Your layout would be recomposed and you can do something then - I'm not sure what kind of action you want to perform, but maybe this will help you:
Copy code
// yourContent is not visible by default
val transitionState = remember { MutableTransitionState(false) }
// trigger it to be visible at some point
transitionState.targetState = isVisible
AnimatedVisibility(transitionState) {
YourContent()
}
if (transitionState.isIdle && transitionState.targetState) {
// here your content is visible and animation is idle
}