diff options
author | Jaz <ericvolp12@gmail.com> | 2023-05-16 21:36:43 -0700 |
---|---|---|
committer | Jaz <ericvolp12@gmail.com> | 2023-05-16 21:36:43 -0700 |
commit | da0ed7e002c926f2a3a342d8d420304b10aa8663 (patch) | |
tree | 56a59e5257b5bf1405d9fd453adf119e9d186830 /src/lib/ThemeContext.tsx | |
parent | 404b2f043c2243961cf5b101a0134f2db3610769 (diff) | |
download | voidsky-da0ed7e002c926f2a3a342d8d420304b10aa8663.tar.zst |
Feat: Use system default color mode, but allow user override
Diffstat (limited to 'src/lib/ThemeContext.tsx')
-rw-r--r-- | src/lib/ThemeContext.tsx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/lib/ThemeContext.tsx b/src/lib/ThemeContext.tsx index ef17c1e7a..251e04e50 100644 --- a/src/lib/ThemeContext.tsx +++ b/src/lib/ThemeContext.tsx @@ -89,10 +89,13 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({ theme, children, }) => { - const colorScheme = useColorScheme() + const colorSchemeFromRN = useColorScheme() + + // if theme is 'system', use the device's configured color scheme + let colorScheme = theme === 'system' ? colorSchemeFromRN : theme const value = useMemo( - () => ((theme || colorScheme) === 'dark' ? darkTheme : defaultTheme), + () => (colorScheme === 'dark' ? darkTheme : defaultTheme), [colorScheme, theme], ) |