diff --git a/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx b/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx index 87724b7..8c9d086 100644 --- a/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx +++ b/src/native_components/RNIModalSheetVIew/RNIModalSheetView.tsx @@ -192,6 +192,15 @@ export const RNIModalSheetView = React.forwardRef< event.nativeEvent ); }} + onModalFocusChange={(event) => { + props.onModalFocusChange?.(event); + event.stopPropagation(); + + modalEventEmitterRef.current!.emit( + 'onModalFocusChange', + event.nativeEvent + ); + }} onModalSheetStateWillChange={(event) => { props.onModalSheetStateWillChange?.(event); event.stopPropagation(); diff --git a/src/types/ModalSheetViewEventEmitter.ts b/src/types/ModalSheetViewEventEmitter.ts index 6dad4c2..eb3b0f4 100644 --- a/src/types/ModalSheetViewEventEmitter.ts +++ b/src/types/ModalSheetViewEventEmitter.ts @@ -1,7 +1,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 { OnModalDidDidDismissEventPayload, OnModalDidHideEventPayload, OnModalDidPresentEventPayload, OnModalDidShowEventPayload, OnModalFocusChangeEventPayload, OnModalWillDismissEventPayload, OnModalWillHideEventPayload, OnModalWillPresentEventPayload, OnModalWillShowEventPayload } from './CommonModalEvents'; import type { OnModalSheetStateDidChangeEventPayload, OnModalSheetStateWillChangeEventPayload, onModalSheetDidAttemptToDismissViaGestureEventPayload, onModalSheetDidDismissViaGestureEventPayload, onModalSheetWillDismissViaGestureEventPayload } from '../native_components/RNIModalSheetVIew'; @@ -15,6 +15,7 @@ export enum ModalSheetViewEvents { onModalDidShow = "onModalDidShow", onModalWillHide = "onModalWillHide", onModalDidHide = "onModalDidHide", + onModalFocusChange = "onModalFocusChange", // presentation controller event delegates onModalSheetWillDismissViaGesture = "onModalSheetWillDismissViaGesture", @@ -37,6 +38,8 @@ export type ModalSheetViewEventEmitterMap = RemapObject