https://kotlinlang.org logo
#compose
Title
# compose
e

eygraber

02/22/2021, 7:38 PM
Is there a way to react to the progress of AnimatedVisibility? My use case is that I have a list of composable functions, and I want to animate additions and deletions to it, so I'm wrapping each item in an AnimatedVisibility. The problem as I understand it is that I can't delete a function from the list until the transition is finished (because then it won't get composed anymore; is that the proper terminology?). My idea is to mark the item as deleted, and remove it once the transition is complete, but I'm not 100% sure how to do that.
d

Doris Liu

02/22/2021, 7:51 PM
When the
AnimatedVisibility
finishes animating out its content, the content will be disposed. For now you could add a
DisposableEffect
in the content like so:
Copy code
DisposableEffect(Unit) {
                        onDispose {
                            // Remove the item
                        }
                    }
😍 1
k

Kort

02/24/2021, 7:44 AM
Thanks! That's real helpful.
👍 1