How can I make the lazyRow go to the last index when I launch my app?
How do I start a lazyRow in the last index on Jetpack Compose?
1.5k views Asked by Henrique Tavolaro At
2
There are 2 answers
0

You can use the method animateScrollToItem
:
Something like:
val itemsList = //... your list
val listState = rememberLazyListState()
// Remember a CoroutineScope to be able to launch
val coroutineScope = rememberCoroutineScope()
LazyColumn(state = listState) {
items(itemsList){
Text( "Item $it" )
}
}
To launch automatically you can use:
DisposableEffect(Unit) {
coroutineScope.launch {
listState.animateScrollToItem(index = itemsList.size-1)
}
onDispose { }
}
Please refer the docs for more here
You can do the same thing for LazyRow