I can't get animateScrollToItem to work.
I've got a lazy list of items and a text to voice function to read them all out, highlighting the one being read.
I want to keep the item being read visible, ideally no lower than a point (the centre?) on the screen.
My highlighting and reading is working but not the scroll.
I've got an item number for the highlighting and reading and I'm trying to feed it to animateScrollToItem within a Launched effect like this
listState = rememberLazyListState()
LaunchedEffect(elementNo.value) {
listState.animateScrollToItem(elementNo.value)
}
where "elementNo" is a mutableState. What am I missing?