From 71a808434eb8fe60e2d1646233343930b75c06e4 Mon Sep 17 00:00:00 2001 From: David Bondy Date: Fri, 24 Feb 2023 16:40:37 -0700 Subject: [PATCH] Revert "Revert "replace onModalHide with onDismiss for the web"" --- src/components/Modal/BaseModal.js | 7 ++++++- src/components/Modal/index.web.js | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/Modal/BaseModal.js b/src/components/Modal/BaseModal.js index a4b7ed90a8fe..d9fccfef3312 100644 --- a/src/components/Modal/BaseModal.js +++ b/src/components/Modal/BaseModal.js @@ -16,11 +16,15 @@ const propTypes = { /** The ref to the modal container */ forwardedRef: PropTypes.func, + + /** Ensure that callback and trap deactivation are in the same loop on the web platform */ + shouldUseOnDismiss: PropTypes.bool, }; const defaultProps = { ...modalDefaultProps, forwardedRef: () => {}, + shouldUseOnDismiss: false, }; class BaseModal extends PureComponent { @@ -109,7 +113,8 @@ class BaseModal extends PureComponent { this.props.onModalShow(); }} propagateSwipe={this.props.propagateSwipe} - onModalHide={this.hideModal} + onDismiss={this.props.shouldUseOnDismiss ? this.hideModal : () => {}} + onModalHide={!this.props.shouldUseOnDismiss ? this.hideModal : () => {}} onSwipeComplete={this.props.onClose} swipeDirection={swipeDirection} isVisible={this.props.isVisible} diff --git a/src/components/Modal/index.web.js b/src/components/Modal/index.web.js index 3cb6f3561b60..24c83001698c 100644 --- a/src/components/Modal/index.web.js +++ b/src/components/Modal/index.web.js @@ -29,6 +29,7 @@ const Modal = (props) => {