Skip to content

Commit

Permalink
🐞 Fix: Fix Events When ModalView is Nested
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Mar 3, 2023
1 parent 31d68a1 commit 3676218
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/components/ModalView/ModalView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,8 @@ export class ModalView extends
ModalViewEmitterEvents.onLayoutModalContentContainer,
event.nativeEvent
);

event.stopPropagation();
};

// the child comp can call `props.getModalRef` to receive
Expand All @@ -277,6 +279,7 @@ export class ModalView extends

_handleOnModalBlur: OnModalBlurEvent = (event) => {
this.props.onModalBlur?.(event);
event.stopPropagation();

this.emitter.emit(
ModalViewEmitterEvents.onModalBlur,
Expand All @@ -286,6 +289,7 @@ export class ModalView extends

_handleOnModalFocus: OnModalFocusEvent = (event) => {
this.props.onModalFocus?.(event);
event.stopPropagation();

this.emitter.emit(
ModalViewEmitterEvents.onModalFocus,
Expand All @@ -295,6 +299,8 @@ export class ModalView extends

_handleOnModalShow: OnModalShowEvent = (event) => {
this.props.onModalShow?.(event);
event.stopPropagation();

this.emitter.emit(
ModalViewEmitterEvents.onModalShow,
event.nativeEvent
Expand All @@ -305,6 +311,8 @@ export class ModalView extends
const props = this.getProps();

this.props.onModalDismiss?.(event);
event.stopPropagation();

this.emitter.emit(
ModalViewEmitterEvents.onModalDismiss,
event.nativeEvent
Expand All @@ -321,6 +329,7 @@ export class ModalView extends

_handleOnModalDidDismiss: OnModalDidDismissEvent = (event) => {
this.props.onModalDidDismiss?.(event);
event.stopPropagation();

this.emitter.emit(
ModalViewEmitterEvents.onModalDidDismiss,
Expand All @@ -330,6 +339,7 @@ export class ModalView extends

_handleOnModalWillDismiss: OnModalDidDismissEvent = (event) => {
this.props.onModalWillDismiss?.(event);
event.stopPropagation();

this.emitter.emit(
ModalViewEmitterEvents.onModalWillDismiss,
Expand All @@ -339,6 +349,7 @@ export class ModalView extends

_handleOnModalAttemptDismiss: OnModalAttemptDismissEvent = (event) => {
this.props.onModalAttemptDismiss?.(event);
event.stopPropagation();

this.emitter.emit(
ModalViewEmitterEvents.onModalAttemptDismiss,
Expand Down

0 comments on commit 3676218

Please sign in to comment.