Automated cherry pick of #3108 (#3113)

* MM-17693 Android fix close settings screen

* Fix unit tests

* fix snapshot
This commit is contained in:
Mattermost Build 2019-08-13 16:34:07 +02:00 committed by Elias Nahum
parent 7bf3020490
commit 94aa1be435
4 changed files with 18 additions and 5 deletions

View file

@ -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,
},

View file

@ -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,
@ -73,6 +74,10 @@ class AdvancedSettings extends PureComponent {
await deleteFileCache();
this.setState({cacheSize: 0, cacheSizedFetched: true});
actions.purgeOfflineStore();
if (Platform.OS === 'android') {
actions.dismissAllModals();
}
});
renderCacheFileSize = () => {

View file

@ -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';
@ -18,6 +19,7 @@ function mapStateToProps(state) {
function mapDispatchToProps(dispatch) {
return {
actions: bindActionCreators({
dismissAllModals,
purgeOfflineStore,
}, dispatch),
};

View file

@ -53,7 +53,7 @@ class Settings extends PureComponent {
componentDidAppear() {
const {actions, componentId} = this.props;
actions.applyTheme(componentId);
actions.applyTheme(componentId, true);
}
navigationButtonPressed({buttonId}) {