MM-17693 Android fix close settings screen (#3108)
* MM-17693 Android fix close settings screen * Fix unit tests
This commit is contained in:
parent
f0a885865f
commit
32f329fca2
4 changed files with 18 additions and 5 deletions
|
|
@ -363,15 +363,21 @@ export function dismissOverlay(componentId) {
|
|||
};
|
||||
}
|
||||
|
||||
export function applyTheme(componentId) {
|
||||
export function applyTheme(componentId, skipBackButtonStyle = false) {
|
||||
return (dispatch, getState) => {
|
||||
const theme = getTheme(getState());
|
||||
|
||||
let backButton = {
|
||||
color: theme.sidebarHeaderTextColor,
|
||||
};
|
||||
|
||||
if (skipBackButtonStyle && Platform.OS === 'android') {
|
||||
backButton = null;
|
||||
}
|
||||
|
||||
Navigation.mergeOptions(componentId, {
|
||||
topBar: {
|
||||
backButton: {
|
||||
color: theme.sidebarHeaderTextColor,
|
||||
},
|
||||
backButton,
|
||||
background: {
|
||||
color: theme.sidebarHeaderBg,
|
||||
},
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ import Config from 'assets/config';
|
|||
class AdvancedSettings extends PureComponent {
|
||||
static propTypes = {
|
||||
actions: PropTypes.shape({
|
||||
dismissAllModals: PropTypes.func.isRequired,
|
||||
purgeOfflineStore: PropTypes.func.isRequired,
|
||||
}).isRequired,
|
||||
intl: intlShape.isRequired,
|
||||
|
|
@ -74,6 +75,10 @@ class AdvancedSettings extends PureComponent {
|
|||
await deleteFileCache();
|
||||
this.setState({cacheSize: 0, cacheSizedFetched: true});
|
||||
actions.purgeOfflineStore();
|
||||
|
||||
if (Platform.OS === 'android') {
|
||||
actions.dismissAllModals();
|
||||
}
|
||||
});
|
||||
|
||||
renderCacheFileSize = () => {
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
import {bindActionCreators} from 'redux';
|
||||
import {connect} from 'react-redux';
|
||||
|
||||
import {dismissAllModals} from 'app/actions/navigation';
|
||||
import {purgeOfflineStore} from 'app/actions/views/root';
|
||||
import {getTheme} from 'mattermost-redux/selectors/entities/preferences';
|
||||
import {isLandscape} from 'app/selectors/device';
|
||||
|
|
@ -19,6 +20,7 @@ function mapStateToProps(state) {
|
|||
function mapDispatchToProps(dispatch) {
|
||||
return {
|
||||
actions: bindActionCreators({
|
||||
dismissAllModals,
|
||||
purgeOfflineStore,
|
||||
}, dispatch),
|
||||
};
|
||||
|
|
|
|||
|
|
@ -54,7 +54,7 @@ class Settings extends PureComponent {
|
|||
|
||||
componentDidAppear() {
|
||||
const {actions, componentId} = this.props;
|
||||
actions.applyTheme(componentId);
|
||||
actions.applyTheme(componentId, true);
|
||||
}
|
||||
|
||||
navigationButtonPressed({buttonId}) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue