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]) }, [siderOrder])
useEffect(() => { useEffect(() => {
setTheme(appTheme)
if (appTheme === 'system') {
setNativeTheme('system')
}
if (appTheme.includes('light')) { if (appTheme.includes('light')) {
setNativeTheme('light') setNativeTheme('light')
} else if (appTheme === 'system') {
setNativeTheme('system')
} else { } else {
setNativeTheme('dark') setNativeTheme('dark')
} }
setTheme(appTheme)
}, [appTheme]) }, [appTheme])
const onDragEnd = async (event: DragEndEvent): Promise<void> => { const onDragEnd = async (event: DragEndEvent): Promise<void> => {

View File

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