Skip to content

Commit

Permalink
Merge pull request #15498 from Expensify/revert-15495-revert-15298-fi…
Browse files Browse the repository at this point in the history
…x-issue-14848

Revert "Revert "replace onModalHide with onDismiss for the web""
  • Loading branch information
Luke9389 authored Feb 25, 2023
2 parents 44d2958 + 71a8084 commit b663634
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/components/Modal/BaseModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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}
Expand Down
1 change: 1 addition & 0 deletions src/components/Modal/index.web.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const Modal = (props) => {
<BaseModal
// eslint-disable-next-line react/jsx-props-no-spreading
{...props}
shouldUseOnDismiss={props.fullscreen}
onModalHide={hideModal}
onModalShow={showModal}
>
Expand Down

0 comments on commit b663634

Please sign in to comment.