diff --git a/src/components/Modal/BaseModal.js b/src/components/Modal/BaseModal.js index 38d0d580e011..749e4980b87b 100644 --- a/src/components/Modal/BaseModal.js +++ b/src/components/Modal/BaseModal.js @@ -39,7 +39,7 @@ class BaseModal extends PureComponent { */ hideModal(callHideCallback = true) { if (this.props.shouldSetModalVisibility) { - setModalVisibility(false); + setModalVisibility(false, true); } if (callHideCallback) { this.props.onModalHide(); @@ -79,7 +79,7 @@ class BaseModal extends PureComponent { onBackButtonPress={this.props.onClose} onModalShow={() => { if (this.props.shouldSetModalVisibility) { - setModalVisibility(true); + setModalVisibility(true, true); } this.props.onModalShow(); }} diff --git a/src/components/ScreenWrapper.js b/src/components/ScreenWrapper.js index b7bc51ada42d..b6d371f6716f 100644 --- a/src/components/ScreenWrapper.js +++ b/src/components/ScreenWrapper.js @@ -40,8 +40,8 @@ const propTypes = { /** Details about any modals being used */ modal: PropTypes.shape({ - /** Indicates if there is a modal currently visible or not */ - isVisible: PropTypes.bool, + /** Indicates if there is a Alert modal currently visible or not */ + isAlertModalVisible: PropTypes.bool, }), }; @@ -67,7 +67,7 @@ class ScreenWrapper extends React.Component { componentDidMount() { this.unsubscribeEscapeKey = KeyboardShortcut.subscribe('Escape', () => { - if (!this.props.modal.isVisible) { + if (!this.props.modal.isAlertModalVisible) { Navigation.dismissModal(); } }, [], true); @@ -88,6 +88,7 @@ class ScreenWrapper extends React.Component { } render() { + console.debug('modal visibility', this.props.modal.isAlertModalVisible); return ( {(insets) => { diff --git a/src/libs/actions/Modal.js b/src/libs/actions/Modal.js index 3c9cd12060c8..93f6f2b0871a 100644 --- a/src/libs/actions/Modal.js +++ b/src/libs/actions/Modal.js @@ -4,10 +4,11 @@ import ONYXKEYS from '../../ONYXKEYS'; /** * Allows other parts of the app to know when a modal has been opened or closed * - * @param {bool} isVisible + * @param {Boolean} isVisible + * @param {Boolean} isAlert */ -function setModalVisibility(isVisible) { - Onyx.merge(ONYXKEYS.MODAL, {isVisible}); +function setModalVisibility(isVisible, isAlert) { + Onyx.merge(ONYXKEYS.MODAL, {isVisible, isAlertModalVisible: isAlert ? isVisible : false}); } export {