Compare commits

...

2 Commits

Author SHA1 Message Date
ammarahm-ed
0f6d85351e mobile: fix color scheme 2023-08-09 09:33:06 +05:00
ammarahm-ed
a4bbfc1e10 mobile: fix theme gets reset on opening share extension 2023-08-09 09:30:00 +05:00

View File

@@ -42,20 +42,24 @@ let appSettings = MMKV.getString(StorageKeys.appSettings);
if (appSettings) {
appSettings = JSON.parse(appSettings);
}
const systemColorScheme = Appearance.getColorScheme();
const appColorScheme = appSettings?.colorScheme;
const useSystemTheme = appSettings?.useSystemTheme;
const currentColorScheme = useSystemTheme ? systemColorScheme : appColorScheme;
const theme =
Appearance.getColorScheme() !== "dark"
? appSettings?.darkThem
currentColorScheme === "dark"
? appSettings?.darkTheme
: appSettings?.lightTheme;
useThemeEngineStore
.getState()
.setTheme(
theme || (Appearance.getColorScheme() === "dark" ? ThemeDark : ThemeLight)
);
const currentTheme =
theme || (currentColorScheme === "dark" ? ThemeDark : ThemeLight);
useThemeEngineStore.getState().setTheme(currentTheme);
export const useShareStore = create((set) => ({
theme:
theme || (Appearance.getColorScheme() === "dark" ? ThemeDark : ThemeLight),
theme: currentTheme,
appendNote: null,
setAppendNote: (note) => {
MMKV.setItem(StorageKeys.appendNote, JSON.stringify(note));