Ensure modals opened from the Settings Sidebar have a close icon (#3994)

* Ensure modals opened from the Settings Sidebar have a close icon

* Feedback during review
This commit is contained in:
Elias Nahum 2020-03-04 08:41:03 -03:00 committed by GitHub
parent 58dcbb215b
commit 06f03d88e9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,7 @@
import React, {PureComponent} from 'react';
import PropTypes from 'prop-types';
import {InteractionManager, ScrollView, View} from 'react-native';
import {ScrollView, View} from 'react-native';
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
import {General} from 'mattermost-redux/constants';
@ -37,14 +37,6 @@ export default class SettingsSidebarBase extends PureComponent {
status: 'offline',
};
constructor(props) {
super(props);
MaterialIcon.getImageSource('close', 20, props.theme.sidebarHeaderTextColor).then((source) => {
this.closeButton = source;
});
}
componentDidMount() {
this.mounted = true;
EventEmitter.on(NavigationTypes.CLOSE_SETTINGS_SIDEBAR, this.closeSettingsSidebar);
@ -138,9 +130,13 @@ export default class SettingsSidebarBase extends PureComponent {
logout();
});
openModal = (screen, title, passProps) => {
openModal = async (screen, title, passProps) => {
this.closeSettingsSidebar();
if (!this.closeButton) {
this.closeButton = await MaterialIcon.getImageSource('close', 20, this.props.theme.sidebarHeaderTextColor);
}
const options = {
topBar: {
leftButtons: [{
@ -150,9 +146,7 @@ export default class SettingsSidebarBase extends PureComponent {
},
};
InteractionManager.runAfterInteractions(() => {
showModal(screen, title, passProps, options);
});
showModal(screen, title, passProps, options);
};
updateStatus = (status) => {