https://kotlinlang.org logo
#compose
Title
# compose
c

Christoph Wiesner

10/07/2022, 1:55 PM
Hi, i’m trying sth similar discussed in this thread Having a Chat UI which should always scroll to latest items (bottom). having
Copy code
LaunchedEffect(items) {
    scrollState.animateScrollToItem(scrollState.layoutInfo.totalItemsCount - 1)
}
Problem I have is that on interaction on the last item (custom view) the last item changes in height bc. it shows more content. How can I make the scrollview scroll not only to the last item but to the very bottom? (Note: i cannot use
reversedLayout
of LazyList bc. I need to be able to determine
firstVisibleItem
(top) for a custom sticky header implementation)
s

ste

10/08/2022, 5:36 AM
You should pass a scroll offset, which is 0 by default
c

Christoph Wiesner

10/10/2022, 6:39 AM
so i’d need to compute the height of the last item and pass the height?
+ as the items do not change the Effect won’t be run - so i’d need to implement some callback to let the list know that the item got updated/taller.
3 Views