joadar
02/17/2022, 4:27 PMval listState = rememberLazyListState(Int.MAX_VALUE, Int.MAX_VALUE)
LaunchedEffect(messages) {
coroutineScope.launch {
listState.scrollToItem(Int.MAX_VALUE, Int.MAX_VALUE)
}
}
But my LazyColumn is like this:
LazyColumn(state = listState) {
items(messages) {...}
if (something) { item {} }
if (somethingElse) { item {} }
if (somethingElse2) { item {} }
}
And the issue is that it doesn’t scroll every time automatically to the latest item displayed (either from the update in items
or a single item
).
Am I doing something wrong?Sean Proctor
02/17/2022, 8:13 PMLaunchedEffect(messages) {
while (listState.isScrollInProgress) {
delay(15)
}
// Do your scroll logic
}
Andrey Kulikov
02/17/2022, 8:28 PMjoadar
02/18/2022, 8:11 AM