When I have a large list of items, OR when i don't have large list of items but each with component renders slowly, the rememberLazyListState.scrollToItem OR rememberLazyListState.animateScrollToItem just don't seem to work in Jetpack Compose LazyColumn. The scroll falls at a random place... I was hoping it'd skip or wait for prev children to render so it can compute the scroll position but it doesn't. Alternative to this would be to build a loop and check firstVisibleItemIndex until it stops increasing but that feels like a major hack!
Compose LazyListState scrollToItem or animatedScrollToItem do not work when there are many items
Asked Answered
Although I don't know why, the following code works for me:
delay(100) // delay 100
listState.value.scrollToItem(index)
© 2022 - 2024 — McMap. All rights reserved.