In my `LazyColumn` I have a static item first, fol...
# compose
z
In my
LazyColumn
I have a static item first, followed by N items that can be added/removed. If I specify a key for my static item, the other item animations will be much smoother. Why is that? The static item itself doesnt change, and even if it were to recompose additional times, etc, its just a simple text composable.
I just realized that its the opposite, if an item at index N+1 is without a key, the animation suffers greatly. I think that makes sense because it will become "a new item" when it shifts to a new index. Anyone can feel free to correct my thinking here 😅
s
If an item doesn't have a key, it gets assigned one based on index in the list which might confuse animations
👍🏽 1
💯 1
z
That makes sense, can you comment on why that would confuse the animations though? Say that I add an item at index N, where N+1 is the item without a key, isnt the logic that item animations run for the item at N.. even if N+1 is considered a completely new item (too)?
s
If you add item for N, then it would consider item N+1 as a completely new item, since N+1 key didn't exist before
👍🏽 1