fix auto theme

This commit is contained in:
pompurin404 2024-08-19 21:07:16 +08:00
parent 2b0433ec41
commit 7e0f58d79d
No known key found for this signature in database
2 changed files with 6 additions and 8 deletions

View File

@ -63,15 +63,14 @@ const App: React.FC = () => {
}, [siderOrder])
useEffect(() => {
setTheme(appTheme)
if (appTheme === 'system') {
setNativeTheme('system')
}
if (appTheme.includes('light')) {
setNativeTheme('light')
} else if (appTheme === 'system') {
setNativeTheme('system')
} else {
setNativeTheme('dark')
}
setTheme(appTheme)
}, [appTheme])
const onDragEnd = async (event: DragEndEvent): Promise<void> => {

View File

@ -82,15 +82,14 @@ const Settings: React.FC = () => {
themeStr += `-${color}`
}
}
setTheme(themeStr)
if (themeStr === 'system') {
setNativeTheme('system')
}
if (themeStr.includes('light')) {
setNativeTheme('light')
} else if (themeStr === 'system') {
setNativeTheme('system')
} else {
setNativeTheme('dark')
}
setTheme(themeStr)
patchAppConfig({ appTheme: themeStr as AppTheme })
} else {
let themeStr = theme