diff --git a/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx b/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx index 0cdec48d..da5c361e 100644 --- a/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx +++ b/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx @@ -147,6 +147,24 @@ export const RNIModalSheetView = React.forwardRef< event.nativeEvent ); }} + onModalSheetStateWillChange={(event) => { + props.onModalSheetStateWillChange?.(event); + event.stopPropagation(); + + modalEventEmitterRef.current!.emit( + 'onModalSheetStateWillChange', + event.nativeEvent, + ); + }} + onModalSheetStateDidChange={(event) => { + props.onModalSheetStateDidChange?.(event); + event.stopPropagation(); + + modalEventEmitterRef.current!.emit( + 'onModalSheetStateDidChange', + event.nativeEvent, + ); + }} > {props.children} diff --git a/src/types/ModalSheetViewEventEmitter.ts b/src/types/ModalSheetViewEventEmitter.ts index 6e924c62..2c6a7776 100644 --- a/src/types/ModalSheetViewEventEmitter.ts +++ b/src/types/ModalSheetViewEventEmitter.ts @@ -1,15 +1,22 @@ import type { TSEventEmitter } from '@dominicstop/ts-event-emitter'; import type { RemapObject } from 'react-native-ios-utilities'; + import type { OnModalDidHideEventPayload, OnModalDidPresentEventPayload, OnModalDidShowEventPayload, OnModalWillHideEventPayload, OnModalWillPresentEventPayload, OnModalWillShowEventPayload } from './CommonModalEvents'; +import type { OnModalSheetStateDidChangeEventPayload, OnModalSheetStateWillChangeEventPayload } from '../native_components/RNIModalSheetVIew'; export enum ModalSheetViewEvents { + // common modal presentation events onModalWillPresent = "onModalWillPresent", onModalDidPresent = "onModalDidPresent", onModalWillShow = "onModalWillShow", onModalDidShow = "onModalDidShow", onModalWillHide = "onModalWillHide", onModalDidHide = "onModalDidHide", + + // modal sheet events + onModalSheetStateWillChange = "onModalSheetStateWillChange", + onModalSheetStateDidChange = "onModalSheetStateDidChange", }; export type ModalSheetViewEventKeys = keyof typeof ModalSheetViewEvents; @@ -21,6 +28,8 @@ export type ModalSheetViewEventEmitterMap = RemapObject; export type ModalSheetViewEventEmitter = TSEventEmitter<