From f06d5c36e42b4e313d98f7fd258d7df0f000081d Mon Sep 17 00:00:00 2001 From: keplyx Date: Tue, 10 Mar 2020 21:35:31 +0100 Subject: [PATCH] Fixed auto dark mode --- utils/ThemeManager.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/utils/ThemeManager.js b/utils/ThemeManager.js index ce1d435..86ae540 100644 --- a/utils/ThemeManager.js +++ b/utils/ThemeManager.js @@ -3,7 +3,7 @@ import AsyncStorageManager from "./AsyncStorageManager"; import {DarkTheme, DefaultTheme} from 'react-native-paper'; import AprilFoolsManager from "./AprilFoolsManager"; -import { Appearance } from 'react-native-appearance'; +import {Appearance} from 'react-native-appearance'; const colorScheme = Appearance.getColorScheme(); @@ -112,8 +112,10 @@ export default class ThemeManager { * @returns {boolean} Night mode state */ static getNightMode(): boolean { - return AsyncStorageManager.getInstance().preferences.nightMode.current === '1' || - AsyncStorageManager.getInstance().preferences.nightModeFollowSystem.current === '1' && colorScheme === 'dark'; + return (AsyncStorageManager.getInstance().preferences.nightMode.current === '1' && + (AsyncStorageManager.getInstance().preferences.nightModeFollowSystem.current !== '1' || + colorScheme === 'no-preference')) || + (AsyncStorageManager.getInstance().preferences.nightModeFollowSystem.current === '1' && colorScheme === 'dark'); } /** @@ -123,7 +125,7 @@ export default class ThemeManager { static getCurrentTheme(): Object { if (AprilFoolsManager.getInstance().isAprilFoolsEnabled()) return AprilFoolsManager.getAprilFoolsTheme(ThemeManager.getWhiteTheme()); - else + else return ThemeManager.getBaseTheme() }