Skip to content

Commit c39d1de

Browse files
committed
fix: 主题切换修复 - 禁用系统主题检测
- 添加 suppressHydrationWarning 到 html 元素 - 设置 enableSystem=false 防止冲突 - 确保主题切换不会被系统主题覆盖 - 保持过渡动画
1 parent ac95867 commit c39d1de

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

platform/src/app/[locale]/layout.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,14 @@ export default async function LocaleLayout({
110110
const messages = await getMessages()
111111

112112
return (
113-
<html lang={locale} className={`${inter.variable} ${notoSansSC.variable}`}>
113+
<html lang={locale} className={`${inter.variable} ${notoSansSC.variable}`} suppressHydrationWarning>
114114
<body className="font-sans antialiased">
115-
<ThemeProvider attribute="class" defaultTheme="dark" enableSystem>
115+
<ThemeProvider
116+
attribute="class"
117+
defaultTheme="dark"
118+
enableSystem={false}
119+
disableTransitionOnChange={false}
120+
>
116121
<NextIntlClientProvider messages={messages}>
117122
{children}
118123
<BackToTop />

0 commit comments

Comments
 (0)