diff --git a/src/components/ModalSheetView/ModalSheetViewTypes.tsx b/src/components/ModalSheetView/ModalSheetViewTypes.tsx index b8ba8406..b2e62d87 100644 --- a/src/components/ModalSheetView/ModalSheetViewTypes.tsx +++ b/src/components/ModalSheetView/ModalSheetViewTypes.tsx @@ -32,6 +32,17 @@ export type ModalSheetViewRef = export type ModalSheetViewInheritedProps = Pick; export type ModalSheetViewBaseProps = { diff --git a/src/index.ts b/src/index.ts index c349ae49..f76d3c53 100644 --- a/src/index.ts +++ b/src/index.ts @@ -3,4 +3,5 @@ export * from './components/ModalSheetView'; export type * from './types/ModalViewControllerMetrics'; export type * from './types/PresentationControllerMetrics'; -export type * from './types/ModalMetrics'; \ No newline at end of file +export type * from './types/ModalMetrics'; +export type * from './types/CommonModalEvents'; \ No newline at end of file diff --git a/src/native_components/RNIModalSheetVIew/RNIModalSheetNativeView.ts b/src/native_components/RNIModalSheetVIew/RNIModalSheetNativeView.ts index 8c66c62f..dea1b054 100644 --- a/src/native_components/RNIModalSheetVIew/RNIModalSheetNativeView.ts +++ b/src/native_components/RNIModalSheetVIew/RNIModalSheetNativeView.ts @@ -6,11 +6,23 @@ import { type NativeProps as RNIModalSheetViewNativeComponentProps, } from './RNIModalSheetViewNativeComponent'; +import type { OnModalWillPresentEvent, OnModalDidPresentEvent, OnModalWillShowEvent, OnModalDidShowEvent, OnModalWillHideEvent, OnModalDidHideEvent } from '../../types/CommonModalEvents'; + + type RNIModalSheetViewNativeComponentBaseProps = NativeComponentBaseProps; export type RNIModalSheetNativeViewBaseProps = RemapObject; export type RNIModalSheetNativeViewProps = diff --git a/src/native_components/RNIModalSheetVIew/RNIModalSheetViewNativeComponent.ts b/src/native_components/RNIModalSheetVIew/RNIModalSheetViewNativeComponent.ts index 799714f9..28db184b 100644 --- a/src/native_components/RNIModalSheetVIew/RNIModalSheetViewNativeComponent.ts +++ b/src/native_components/RNIModalSheetVIew/RNIModalSheetViewNativeComponent.ts @@ -1,4 +1,5 @@ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent'; + import type { BubblingEventHandler, Int32 } from 'react-native/Libraries/Types/CodegenTypes'; import type { HostComponent, ViewProps } from 'react-native'; @@ -7,6 +8,14 @@ export interface NativeProps extends ViewProps { // common/shared events onDidSetViewID?: BubblingEventHandler<{}>; + onModalWillPresent?: BubblingEventHandler<{}>; + onModalDidPresent?: BubblingEventHandler<{}>; + + onModalWillShow?: BubblingEventHandler<{}>; + onModalDidShow?: BubblingEventHandler<{}>; + onModalWillHide?: BubblingEventHandler<{}>; + onModalDidHide?: BubblingEventHandler<{}>; + // value prop stubs reactChildrenCount: Int32; }; diff --git a/src/native_components/RNIModalSheetVIew/RNIModalSheetViewTypes.ts b/src/native_components/RNIModalSheetVIew/RNIModalSheetViewTypes.ts index d525e66f..d6b21750 100644 --- a/src/native_components/RNIModalSheetVIew/RNIModalSheetViewTypes.ts +++ b/src/native_components/RNIModalSheetVIew/RNIModalSheetViewTypes.ts @@ -26,6 +26,14 @@ export type RNIModalSheetViewRef = { export type RNIModalSheetViewInheritedOptionalProps = Partial>; export type RNIModalSheetViewBaseProps = { diff --git a/src/types/CommonModalEvents.ts b/src/types/CommonModalEvents.ts new file mode 100644 index 00000000..1306724a --- /dev/null +++ b/src/types/CommonModalEvents.ts @@ -0,0 +1,39 @@ +import type { BubblingEventHandler } from 'react-native/Libraries/Types/CodegenTypes'; + + +// MARK: Event Objects +// ------------------- + +export type OnModalWillPresentPayload = Readonly<{}>; + +export type OnModalDidPresentEventPayload = Readonly<{}>; + +export type OnModalWillShowEventPayload = Readonly<{}>; + +export type OnModalDidShowEventPayload = Readonly<{}>; + +export type OnModalWillHideEventPayload = Readonly<{}>; + +export type OnModalDidHideEventPayload = Readonly<{}>; + +// MARK: Events +// ------------ + +export type OnModalWillPresentEvent = + BubblingEventHandler; + +export type OnModalDidPresentEvent = + BubblingEventHandler; + +export type OnModalWillShowEvent = + BubblingEventHandler; + +export type OnModalDidShowEvent = + BubblingEventHandler; + +export type OnModalWillHideEvent = + BubblingEventHandler; + +export type OnModalDidHideEvent = + BubblingEventHandler; +