mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
mobile: fix theme gets reset on opening share extension
This commit is contained in:
@@ -42,20 +42,23 @@ let appSettings = MMKV.getString(StorageKeys.appSettings);
|
||||
if (appSettings) {
|
||||
appSettings = JSON.parse(appSettings);
|
||||
}
|
||||
const theme =
|
||||
Appearance.getColorScheme() !== "dark"
|
||||
? appSettings?.darkThem
|
||||
: appSettings?.lightTheme;
|
||||
|
||||
useThemeEngineStore
|
||||
.getState()
|
||||
.setTheme(
|
||||
theme || (Appearance.getColorScheme() === "dark" ? ThemeDark : ThemeLight)
|
||||
);
|
||||
const systemColorScheme = Appearance.getColorScheme();
|
||||
const appColorScheme = appSettings.colorScheme;
|
||||
const useSystemTheme = appSettings.useSystemTheme;
|
||||
const currentColorScheme = useSystemTheme ? systemColorScheme : appColorScheme;
|
||||
|
||||
const theme = currentColorScheme
|
||||
? appSettings?.darkTheme
|
||||
: appSettings?.lightTheme;
|
||||
|
||||
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));
|
||||
|
||||
Reference in New Issue
Block a user