From 996d8c104ff9650a8b171ff8c6bee0ca19261008 Mon Sep 17 00:00:00 2001 From: xfy Date: Mon, 18 May 2026 15:43:09 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=82=B9=E5=87=BB"=E4=BB=8A?= =?UTF-8?q?=E5=A4=A9"=E6=8C=89=E9=92=AE=E6=97=A0=E5=8A=A8=E7=94=BB?= =?UTF-8?q?=EF=BC=9AscrollToPage=20=E6=94=B9=E4=B8=BA=20animateScrollToPag?= =?UTF-8?q?e?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LaunchedEffect(selectedDate) 用无动画的 scrollToPage 抢先跳转, 导致 onToday 里的 animateScrollToPage 被取消。统一由 LaunchedEffect 处理滚动,onToday 只需 selectDate。 Co-Authored-By: Claude Opus 4.7 --- .../kotlin/plus/rua/project/ui/CalendarMonthView.kt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt index 767309c..0cce0aa 100644 --- a/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt +++ b/shared/src/commonMain/kotlin/plus/rua/project/ui/CalendarMonthView.kt @@ -132,7 +132,7 @@ fun CalendarMonthView( today.year, today.month.number ) if (targetPage != pagerState.currentPage) { - pagerState.scrollToPage(targetPage) + pagerState.animateScrollToPage(targetPage) } } @@ -239,14 +239,6 @@ fun CalendarMonthView( showToday = viewModel.selectedDate != today, onToday = { viewModel.selectDate(today) - @Suppress("DEPRECATION") // monthNumber 无替代 API - val targetPage = yearMonthToPage( - today.year, today.month.number, - today.year, today.month.number - ) - if (targetPage != pagerState.currentPage) { - coroutineScope.launch { pagerState.animateScrollToPage(targetPage) } - } }, modifier = Modifier.onSizeChanged { size -> monthHeaderHeightPx = size.height