From b888791a2c07a4b05221e03c0b7b834d8c4c3b33 Mon Sep 17 00:00:00 2001 From: Dominic Go Date: Wed, 2 Oct 2024 19:28:05 +0800 Subject: [PATCH] =?UTF-8?q?=E2=AD=90=EF=B8=8F=20Impl:=20`OnModalFocusChang?= =?UTF-8?q?eEventPayload.modalLevel`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift | 6 ++++++ src/types/CommonModalEvents.ts | 1 + 2 files changed, 7 insertions(+) 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;