Hi I’ve experimented with ```Modifier.animateItemP...
# compose
r
Hi I’ve experimented with
Copy code
Modifier.animateItemPlacement()
function of lazy list. There is a bug when we add an item to the first index of a lazy list which is full and scrollable at this moment. When it is not full added item is animated but when it is full it is not animating. As a workaround I added extra item to the top of lazy list via
Copy code
item("hint") { }
a
can you maybe explain it in a bit more details? I don’t really understand what do you mean by full, sorry. also note that the scroll position is maintained by the key, so if you add an item before the first visible item there will be no scroll or animation, we just stay on the same item
👍 1
r
So it's intended behavior
a
seems like you saw exactly what I described, right? yes, it will work like this even without item animations
what behavior did you expect?
r
I expected the list to be scrolled if the added item position is visible one
a
so if you currently display some item B as the first visible item and then add A before B then this will not be animated as we still stay on B and A is not in the visible area
in other cases there should be an animation
Now I’ve added extra item at the top of a lazy list
a
everything seems to work as expected on this video. what exactly is wrong in your opinion?
r
@Andrey Kulikov everything works as I expected because I added extra item at the top of lazy list. If I remove it the animation won’t work
a
got it. so basically you want to stay on top of the list if you were on top previously when there is a new item added as the first one, right?
r
@Andrey Kulikov yes exactly
a
thanks, I will think how to make it simpler to configure this behavior. good that you found a simple workaround
🙏 1