about summary refs log tree commit diff
path: root/src/lib/ThemeContext.tsx
diff options
context:
space:
mode:
authorPaul Frazee <pfrazee@gmail.com>2023-05-30 21:13:34 -0500
committerPaul Frazee <pfrazee@gmail.com>2023-05-30 21:13:34 -0500
commit421f29ad980e73454f7812e79bff852f362b643e (patch)
treeb5f67e7099db815b8f03c7229b94eeb990e52180 /src/lib/ThemeContext.tsx
parente224569a11b82361d782324a63bdfc19d44a3201 (diff)
parent2413549fa5ae77c1d0ca3d91cf43c2ef41c35d63 (diff)
downloadvoidsky-421f29ad980e73454f7812e79bff852f362b643e.tar.zst
Merge branch 'ericvolp12-inherit_system_theme' into main
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],
   )