mirror of
https://github.com/ecency/ecency-mobile.git
synced 2024-12-20 20:01:56 +03:00
properly setting redux isDarkTheme and setTheme separatly to differ between active and saved state
This commit is contained in:
parent
5bde1928e6
commit
1ba07401e0
@ -1,5 +1,5 @@
|
||||
import React, { Component } from 'react';
|
||||
import { Platform, Alert } from 'react-native';
|
||||
import { Platform, Alert, Appearance } from 'react-native';
|
||||
import { connect } from 'react-redux';
|
||||
import { Client } from '@hiveio/dhive';
|
||||
import VersionNumber from 'react-native-version-number';
|
||||
@ -7,6 +7,8 @@ import Config from 'react-native-config';
|
||||
import { injectIntl } from 'react-intl';
|
||||
import messaging from '@react-native-firebase/messaging';
|
||||
import { languageRestart } from '../../../utils/I18nUtils';
|
||||
import THEME_OPTIONS from '../../../constants/options/theme';
|
||||
|
||||
// Realm
|
||||
import {
|
||||
getExistUser,
|
||||
@ -22,6 +24,7 @@ import {
|
||||
setAuthStatus,
|
||||
setExistUser,
|
||||
removeAllUserData,
|
||||
getTheme,
|
||||
} from '../../../realm/realm';
|
||||
|
||||
// Services and Actions
|
||||
@ -119,6 +122,21 @@ class SettingsContainer extends Component {
|
||||
setNsfw2DB(action);
|
||||
break;
|
||||
|
||||
case 'theme':
|
||||
let setting = THEME_OPTIONS[action].value;
|
||||
const systemTheme = Appearance.getColorScheme();
|
||||
|
||||
dispatch(isDarkTheme(setting === null
|
||||
? systemTheme === 'dark'
|
||||
: setting
|
||||
));
|
||||
|
||||
setTheme(setting);
|
||||
this.setState({
|
||||
themeSetting:setting
|
||||
})
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -208,11 +226,6 @@ class SettingsContainer extends Component {
|
||||
this._handleNotification(action, actionType);
|
||||
break;
|
||||
|
||||
case 'theme':
|
||||
dispatch(isDarkTheme(action));
|
||||
setTheme(action);
|
||||
break;
|
||||
|
||||
case 'default_footer':
|
||||
dispatch(isDefaultFooter(action));
|
||||
// setDefaultFooter(action);
|
||||
|
Loading…
Reference in New Issue
Block a user