add variable to monitor scrolling as scroll fix

This commit is contained in:
IanRDavies
2022-03-09 15:56:08 +00:00
parent 29af079a8f
commit e90e10bd26

View File

@@ -138,6 +138,7 @@ fun ChatInfoToolbar(chat: Chat, back: () -> Unit, info: () -> Unit) {
@Composable
fun ChatItemsList(chatItems: List<ChatItem>) {
val listState = rememberLazyListState()
var scrolled = false
val scope = rememberCoroutineScope()
val uriHandler = LocalUriHandler.current
LazyColumn(state = listState) {
@@ -145,8 +146,9 @@ fun ChatItemsList(chatItems: List<ChatItem>) {
ChatItemView(cItem, uriHandler)
}
val len = chatItems.count()
if (len > 1) {
if (len > 1 && !scrolled) {
scope.launch {
scrolled = true
listState.animateScrollToItem(len - 1)
}
}