From 918be31f2c2cc7c4a109dbaab454bd7e071566ae Mon Sep 17 00:00:00 2001 From: Stanislav Dmitrenko <7953703+avently@users.noreply.github.com> Date: Fri, 19 Apr 2024 21:57:00 +0700 Subject: [PATCH] desktop: fix freeze that happened when new chat items arrives while scrolling via scrollbar (#4050) --- .../kotlin/chat/simplex/common/views/chat/ChatView.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt index 4761b938b9..55ee46f1e2 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/ChatView.kt @@ -1090,9 +1090,9 @@ private fun ScrollToBottom(chatId: ChatId, listState: LazyListState, chatItems: .collect { try { if (listState.firstVisibleItemIndex == 0 || (listState.firstVisibleItemIndex == 1 && listState.layoutInfo.totalItemsCount == chatItems.size)) { - listState.animateScrollToItem(0) + if (appPlatform.isAndroid) listState.animateScrollToItem(0) else listState.scrollToItem(0) } else { - listState.animateScrollBy(scrollDistance) + if (appPlatform.isAndroid) listState.animateScrollBy(scrollDistance) else listState.scrollBy(scrollDistance) } } catch (e: CancellationException) { /**