diff options
author | Paul Frazee <pfrazee@gmail.com> | 2023-05-30 21:13:34 -0500 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2023-05-30 21:13:34 -0500 |
commit | 421f29ad980e73454f7812e79bff852f362b643e (patch) | |
tree | b5f67e7099db815b8f03c7229b94eeb990e52180 /src/lib/ThemeContext.tsx | |
parent | e224569a11b82361d782324a63bdfc19d44a3201 (diff) | |
parent | 2413549fa5ae77c1d0ca3d91cf43c2ef41c35d63 (diff) | |
download | voidsky-421f29ad980e73454f7812e79bff852f362b643e.tar.zst |
Merge branch 'ericvolp12-inherit_system_theme' into main
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], ) |