From e65a35a239f98b3b589a6013095bd9041b1bb043 Mon Sep 17 00:00:00 2001 From: AskaEth Date: Wed, 27 May 2026 12:43:57 +0800 Subject: [PATCH] fix: remove AnimatedVisibility from chat bubbles to fix LazyColumn scroll limit AnimatedVisibility with visible=false starts items at zero height. Inside a reverseLayout LazyColumn, this causes the list to miscompute total content height, preventing items beyond the visible viewport from being composed. This was limiting the chat to ~9 visible messages that filled the screen. Co-Authored-By: Claude Opus 4.7 --- .../yeij/cyrene/ui/screens/chat/ChatScreen.kt | 31 +++++-------------- 1 file changed, 7 insertions(+), 24 deletions(-) diff --git a/app/src/main/java/top/yeij/cyrene/ui/screens/chat/ChatScreen.kt b/app/src/main/java/top/yeij/cyrene/ui/screens/chat/ChatScreen.kt index 2a02bfa..a32092e 100644 --- a/app/src/main/java/top/yeij/cyrene/ui/screens/chat/ChatScreen.kt +++ b/app/src/main/java/top/yeij/cyrene/ui/screens/chat/ChatScreen.kt @@ -1,8 +1,5 @@ package top.yeij.cyrene.ui.screens.chat -import androidx.compose.animation.AnimatedVisibility -import androidx.compose.animation.fadeIn -import androidx.compose.animation.slideInVertically import androidx.compose.foundation.background import androidx.compose.foundation.gestures.detectDragGesturesAfterLongPress import androidx.compose.foundation.layout.Box @@ -67,33 +64,19 @@ import top.yeij.cyrene.ui.components.TypingIndicator import top.yeij.cyrene.util.RecordState import top.yeij.cyrene.viewmodel.ChatViewModel import top.yeij.cyrene.viewmodel.SettingsViewModel -import kotlin.math.min + @Composable private fun AnimatedChatBubble( message: Message, animIndex: Int, ) { - var visible by remember { mutableStateOf(false) } - LaunchedEffect(Unit) { - delay(min(animIndex, 10) * 60L) - visible = true - } - AnimatedVisibility( - visible = visible, - enter = fadeIn(animationSpec = androidx.compose.animation.core.tween(300)) + - slideInVertically( - animationSpec = androidx.compose.animation.core.tween(300), - initialOffsetY = { it / 4 }, - ), - ) { - ChatBubble( - content = message.content, - role = message.role, - msgType = message.msgType, - timestamp = message.timestamp, - ) - } + ChatBubble( + content = message.content, + role = message.role, + msgType = message.msgType, + timestamp = message.timestamp, + ) } @Composable