From a88ac217c2f21accd964703fecf4e6e3f92a8033 Mon Sep 17 00:00:00 2001 From: Eric Bailey Date: Thu, 14 Sep 2023 12:55:47 -0500 Subject: [PATCH] fix theme switching on web without refresh --- src/lib/ThemeContext.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib/ThemeContext.tsx b/src/lib/ThemeContext.tsx index fe25dde5..a8208852 100644 --- a/src/lib/ThemeContext.tsx +++ b/src/lib/ThemeContext.tsx @@ -1,3 +1,4 @@ +import {isWeb} from 'platform/detection' import React, {ReactNode, createContext, useContext} from 'react' import { AppState, @@ -101,6 +102,10 @@ export const ThemeProvider: React.FC = ({ React.useState(colorSchemeFromRN) React.useEffect(() => { + if (isWeb) { + setNativeColorScheme(colorSchemeFromRN) + } + const subscription = AppState.addEventListener('change', state => { const isActive = state === 'active'