diff --git a/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx b/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx index 1c688cad..87724b7b 100644 --- a/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx +++ b/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx @@ -165,6 +165,33 @@ export const RNIModalSheetView = React.forwardRef< event.nativeEvent ); }} + onModalSheetWillDismissViaGesture={(event) => { + props.onModalSheetWillDismissViaGesture?.(event); + event.stopPropagation(); + + modalEventEmitterRef.current!.emit( + 'onModalSheetWillDismissViaGesture', + event.nativeEvent + ); + }} + onModalSheetDidDismissViaGesture={(event) => { + props.onModalSheetDidDismissViaGesture?.(event); + event.stopPropagation(); + + modalEventEmitterRef.current!.emit( + 'onModalSheetDidDismissViaGesture', + event.nativeEvent + ); + }} + onModalSheetDidAttemptToDismissViaGesture={(event) => { + props.onModalSheetDidAttemptToDismissViaGesture?.(event); + event.stopPropagation(); + + modalEventEmitterRef.current!.emit( + 'onModalSheetDidAttemptToDismissViaGesture', + event.nativeEvent + ); + }} onModalSheetStateWillChange={(event) => { props.onModalSheetStateWillChange?.(event); event.stopPropagation(); diff --git a/src/types/ModalSheetViewEventEmitter.ts b/src/types/ModalSheetViewEventEmitter.ts index b6708fc9..6dad4c29 100644 --- a/src/types/ModalSheetViewEventEmitter.ts +++ b/src/types/ModalSheetViewEventEmitter.ts @@ -2,7 +2,7 @@ import type { TSEventEmitter } from '@dominicstop/ts-event-emitter'; import type { RemapObject } from 'react-native-ios-utilities'; import type { OnModalDidDidDismissEventPayload, OnModalDidHideEventPayload, OnModalDidPresentEventPayload, OnModalDidShowEventPayload, OnModalWillDismissEventPayload, OnModalWillHideEventPayload, OnModalWillPresentEventPayload, OnModalWillShowEventPayload } from './CommonModalEvents'; -import type { OnModalSheetStateDidChangeEventPayload, OnModalSheetStateWillChangeEventPayload } from '../native_components/RNIModalSheetVIew'; +import type { OnModalSheetStateDidChangeEventPayload, OnModalSheetStateWillChangeEventPayload, onModalSheetDidAttemptToDismissViaGestureEventPayload, onModalSheetDidDismissViaGestureEventPayload, onModalSheetWillDismissViaGestureEventPayload } from '../native_components/RNIModalSheetVIew'; export enum ModalSheetViewEvents { @@ -16,6 +16,11 @@ export enum ModalSheetViewEvents { onModalWillHide = "onModalWillHide", onModalDidHide = "onModalDidHide", + // presentation controller event delegates + onModalSheetWillDismissViaGesture = "onModalSheetWillDismissViaGesture", + onModalSheetDidDismissViaGesture = "onModalSheetDidDismissViaGesture", + onModalSheetDidAttemptToDismissViaGesture = "onModalSheetDidAttemptToDismissViaGesture", + // modal sheet events onModalSheetStateWillChange = "onModalSheetStateWillChange", onModalSheetStateDidChange = "onModalSheetStateDidChange", @@ -32,6 +37,9 @@ export type ModalSheetViewEventEmitterMap = RemapObject;