diff --git a/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift b/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift index 9774453..f3df228 100644 --- a/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift +++ b/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift @@ -480,11 +480,17 @@ extension RNIModalSheetViewDelegate: ModalFocusEventNotifiable { currentState: ModalFocusState, nextState: ModalFocusState ) { + + let modalLevel = + viewController.modalRegistryEntry?.modalFocusIndex + ?? viewController.modalLevel + ?? -1; var payload: Dictionary = [ "viewControllerInstanceID": viewController.synthesizedStringID, "currentState": currentState.rawValue, "nextState": nextState.rawValue, + "modalLevel": modalLevel, ]; payload.unwrapAndMerge(withOther: [ diff --git a/src/types/CommonModalEvents.ts b/src/types/CommonModalEvents.ts index 0151f9b..df7580f 100644 --- a/src/types/CommonModalEvents.ts +++ b/src/types/CommonModalEvents.ts @@ -49,6 +49,7 @@ export type OnModalDidHideEventPayload = Readonly<{ export type OnModalFocusChangeEventPayload = Readonly<{ viewControllerInstanceID: string; + modalLevel: number; prevState?: ModalFocusState; currentState: ModalFocusState; nextState: ModalFocusState;