mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-24 07:29:30 +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) {
|
if (appSettings) {
|
||||||
appSettings = JSON.parse(appSettings);
|
appSettings = JSON.parse(appSettings);
|
||||||
}
|
}
|
||||||
const theme =
|
|
||||||
Appearance.getColorScheme() !== "dark"
|
|
||||||
? appSettings?.darkThem
|
|
||||||
: appSettings?.lightTheme;
|
|
||||||
|
|
||||||
useThemeEngineStore
|
const systemColorScheme = Appearance.getColorScheme();
|
||||||
.getState()
|
const appColorScheme = appSettings.colorScheme;
|
||||||
.setTheme(
|
const useSystemTheme = appSettings.useSystemTheme;
|
||||||
theme || (Appearance.getColorScheme() === "dark" ? ThemeDark : ThemeLight)
|
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) => ({
|
export const useShareStore = create((set) => ({
|
||||||
theme:
|
theme: currentTheme,
|
||||||
theme || (Appearance.getColorScheme() === "dark" ? ThemeDark : ThemeLight),
|
|
||||||
appendNote: null,
|
appendNote: null,
|
||||||
setAppendNote: (note) => {
|
setAppendNote: (note) => {
|
||||||
MMKV.setItem(StorageKeys.appendNote, JSON.stringify(note));
|
MMKV.setItem(StorageKeys.appendNote, JSON.stringify(note));
|
||||||
|
|||||||
Reference in New Issue
Block a user