From 0bfb705139d576b0dc45785528c01133bc894ff7 Mon Sep 17 00:00:00 2001 From: Christoph Pader Date: Mon, 27 Nov 2023 18:40:56 +0100 Subject: [PATCH] adapt Themes --- src/styles/themes/ThemeProvider.tsx | 2 +- src/styles/themes/Themes.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/styles/themes/ThemeProvider.tsx b/src/styles/themes/ThemeProvider.tsx index 20f97025c36a..5d4560314812 100644 --- a/src/styles/themes/ThemeProvider.tsx +++ b/src/styles/themes/ThemeProvider.tsx @@ -18,7 +18,7 @@ type ThemeProviderProps = React.PropsWithChildren & { function ThemeProvider({children, theme: staticThemePreference}: ThemeProviderProps) { const themePreference = useThemePreferenceWithStaticOverride(staticThemePreference); - const theme = useMemo(() => Themes[themePreference], [themePreference]); + const theme = useMemo(() => Themes[themePreference].theme, [themePreference]); return {children}; } diff --git a/src/styles/themes/Themes.ts b/src/styles/themes/Themes.ts index a87407790502..f5729c2ccae2 100644 --- a/src/styles/themes/Themes.ts +++ b/src/styles/themes/Themes.ts @@ -3,9 +3,12 @@ import darkTheme from './default'; import lightTheme from './light'; import {ThemeColors, ThemePreferenceWithoutSystem} from './types'; +// There might be more themes than just "dark" and "light". +// Still, status bar, scrollbar and other components might need to adapt based on if the theme is overly light or dark +// e.g. the StatusBar displays either "light-content" or "dark-content" based on the theme const Themes = { - [CONST.THEME.LIGHT]: lightTheme, - [CONST.THEME.DARK]: darkTheme, -} satisfies Record; + [CONST.THEME.LIGHT]: {theme: lightTheme, isLight: true}, + [CONST.THEME.DARK]: {theme: darkTheme, isLight: false}, +} satisfies Record; export default Themes;