From da0ed7e002c926f2a3a342d8d420304b10aa8663 Mon Sep 17 00:00:00 2001
From: Jaz <ericvolp12@gmail.com>
Date: Tue, 16 May 2023 21:36:43 -0700
Subject: Feat: Use system default color mode, but allow user override

---
 src/lib/ThemeContext.tsx | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

(limited to 'src/lib/ThemeContext.tsx')

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],
   )
 
-- 
cgit 1.4.1

