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

reactormonk

09/30/2022, 11:59 AM
I wanted to create a scrolling log - LazyColumn looks like the right container for that, but how would I scroll to the newest item whenever one is added?
s

ste

09/30/2022, 12:05 PM
Something along this:
Copy code
LaunchedEffect(lazyListState) {
    snapshotFlow {
        lazyListState.layoutInfo.totalItemsCount
    }.collect {
        lazyListState.animateScrollToItem(it)
    }
}
2 Views