about summary refs log tree commit diff
path: root/src/lib/ThemeContext.tsx
diff options
context:
space:
mode:
authorJaz <ericvolp12@gmail.com>2023-05-16 21:36:43 -0700
committerJaz <ericvolp12@gmail.com>2023-05-16 21:36:43 -0700
commitda0ed7e002c926f2a3a342d8d420304b10aa8663 (patch)
tree56a59e5257b5bf1405d9fd453adf119e9d186830 /src/lib/ThemeContext.tsx
parent404b2f043c2243961cf5b101a0134f2db3610769 (diff)
downloadvoidsky-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.tsx7
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],
   )