Has anyone managed to successfully use `LazyListSt...
# compose
a
Has anyone managed to successfully use
LazyListState.animateScrollToItem
to scroll forward such that the item’s bottom aligns to the bottom of the list? I was hoping
animateScrollToItem(index+1, -viewportHeight)
would do the trick, but unfortunately it does a weird overscroll and then scroll back to position. Any other idea I’ve had involves knowing the height of the item.
a
My guess that spring animation spec causing this.
s
Does it work to use BringIntoViewRequester https://cs.android.com/androidx/platform/frameworks/support/+/androidx-main:compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/relocation/BringIntoViewRequester.kt;l=70?q=BringIntoViewRequester to try to bring it into the view instead? It might then bring it just enough so that it's on the screen, so if it was further down, it might appear at the bottom of the list? But this might not work for lazy lists tbh
a
It can’t work. The item lambda passed to e.g.
LazyListScope.items
is never even executed for non-visible items, so the
BringIntoViewRequester
isn’t attached to any node.
👍 1
and you can’t use it on the
LazyList
itself because you don’t know the
Rect
to pass to
BringIntoViewRequester.bringIntoView
(because, again, you don’t know the item heights)