I'm using the latest version of Jetpack Compose - 1.1.0-beta04
I tried to scroll list with animateScrollToItem(0) for case when firstVisibleItemIndex == 0 the scrolling works good with spring animation. But if I scroll from the second item, my LazyList jumps without animations:
Reproduced with simple example:
val state = rememberLazyListState()
val scope = rememberCoroutineScope()
Box(modifier = Modifier.fillMaxSize()) {
LazyColumn(
state = state,
reverseLayout = true
) {
items(1000) {
Card(
modifier = Modifier
.padding(horizontal = 12.dp)
.fillMaxWidth()
.padding(12.dp)
) {
Text(
text = "Message: $it",
fontSize = 20.sp,
modifier = Modifier.padding(12.dp)
)
}
}
}
Button(
text = "Scroll",
modifier = Modifier
.align(Alignment.BottomEnd)
.padding(16.dp)
) {
scope.launch {
state.animateScrollToItem(0)
}
}
}
