mirror of
https://github.com/ecency/ecency-mobile.git
synced 2025-01-02 02:31:41 +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 React, { Component } from 'react';
|
||||||
import { Platform, Alert } from 'react-native';
|
import { Platform, Alert, Appearance } from 'react-native';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { Client } from '@hiveio/dhive';
|
import { Client } from '@hiveio/dhive';
|
||||||
import VersionNumber from 'react-native-version-number';
|
import VersionNumber from 'react-native-version-number';
|
||||||
@ -7,6 +7,8 @@ import Config from 'react-native-config';
|
|||||||
import { injectIntl } from 'react-intl';
|
import { injectIntl } from 'react-intl';
|
||||||
import messaging from '@react-native-firebase/messaging';
|
import messaging from '@react-native-firebase/messaging';
|
||||||
import { languageRestart } from '../../../utils/I18nUtils';
|
import { languageRestart } from '../../../utils/I18nUtils';
|
||||||
|
import THEME_OPTIONS from '../../../constants/options/theme';
|
||||||
|
|
||||||
// Realm
|
// Realm
|
||||||
import {
|
import {
|
||||||
getExistUser,
|
getExistUser,
|
||||||
@ -22,6 +24,7 @@ import {
|
|||||||
setAuthStatus,
|
setAuthStatus,
|
||||||
setExistUser,
|
setExistUser,
|
||||||
removeAllUserData,
|
removeAllUserData,
|
||||||
|
getTheme,
|
||||||
} from '../../../realm/realm';
|
} from '../../../realm/realm';
|
||||||
|
|
||||||
// Services and Actions
|
// Services and Actions
|
||||||
@ -119,6 +122,21 @@ class SettingsContainer extends Component {
|
|||||||
setNsfw2DB(action);
|
setNsfw2DB(action);
|
||||||
break;
|
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:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -208,11 +226,6 @@ class SettingsContainer extends Component {
|
|||||||
this._handleNotification(action, actionType);
|
this._handleNotification(action, actionType);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'theme':
|
|
||||||
dispatch(isDarkTheme(action));
|
|
||||||
setTheme(action);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'default_footer':
|
case 'default_footer':
|
||||||
dispatch(isDefaultFooter(action));
|
dispatch(isDefaultFooter(action));
|
||||||
// setDefaultFooter(action);
|
// setDefaultFooter(action);
|
||||||
|
Loading…
Reference in New Issue
Block a user