I’m using `LazyColumn` with `itemsIndexed` with ke...
# compose
r
I’m using
LazyColumn
with
itemsIndexed
with keys and have
Modifier.animateItemPlacement()
on my items. The list of items is immutable inside a mutableStateOf(). I can delete items one at a time (replacing with a new immutable list) and the animations appear to work as expected. However, I am confused by this comment from the documentation on animateItemPlacement(): “Aside from reorderings, item animations for additions and removals is currently in development.” (I am using Compose 1.3.0-beta03 and Material 3 1.0.0-beta03, the version prior to what just came out today.) Is that note out of date, does it not apply to my case, or am I just lucky?
👀 1
a
There is no animation for item addition/removal. The animations you see is likely movement animations of items after the removed item.
r
Yes, with
Modifier.animateItemPlacement()
I see the items moving to fill in the deleted space (it could be items above or below, depending on where I am scrolled to and which item I delete). I guess I don’t know what “animations for additions and removals” is then, because I got everything I thought I wanted.
a
For example if you add an item to the end of the list, the item will appear immediately without any animation. Same for removing an item.
r
Yes, the only time I don’t see animation is deleting the last item (my screen that shows the items doesn’t allow for adding but I assume it works the same way as you said). So I guess you’re saying the open “todo” for animateItemPlacement is to animate the item itself as it goes away (whether it shrinks or pops out or whatever the correct terminology is)? If that’s all it is then I now understand, and I can live with how it works now. Thanks.
406 Views