Is it possible to make the Composable not clip wit...
# compose
a
Is it possible to make the Composable not clip within its bounds when using AnimatedVisibility? slideInVertically() seems unusable due to the clipping
d
slideInVertically
shouldn't clip, but its parent may choose to clip it. Which composable are you seeing the clipping in?
a
ah. I’m trying to animate my LazyColumn items
d
That sounds like a reasonable use case. Please file a bug if there's no good way to do it through public API. 🙂
a
Thanks! I’m going to see what I can find and do that if I can’t otherwise.
Ok I guess I can file it as a bug and it can either be considered or set to won’t fix
d
In LazyColumn(For) you'll need to hoist the state for whether the item has been shown. If an item has been shown, you can set the
initiallyVisible
param to true, to prevent animations from firing.
a
I’ve been trying to do that but I’m encountering problems. It recomposes instantly in my case and doesn’t animate. I can’t find API to listen to the end of the animation. If it isn’t too much to ask could you provide a minimal sample of what you mean?
d
Without knowing the details of your use case, my advice is around preventing items from animating when added to the tree again:
Copy code
val items = remember { colors.map {
    Pair(it, mutableStateOf(false) /*initiallyVisible*/) } }
LazyColumnFor(
    items
) {
    AnimatedVisibility(true, initiallyVisible = it.second.value) {
        onDispose {
            it.second.value = true
        }
        // Children here
    }
}
a
Thank you! That works
157 Views