diff --git a/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift b/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift index 5fa10f6..c7e3cfa 100644 --- a/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift +++ b/ios/RNIModalSheetView/RNIModalSheetViewDelegate.swift @@ -459,6 +459,7 @@ extension RNIModalSheetViewDelegate: ModalSheetViewControllerEventsNotifiable { extension RNIModalSheetViewDelegate: ModalFocusEventNotifiable { public func notifyForModalFocusStateChange( + forViewController viewController: UIViewController, prevState: ModalFocusState?, currentState: ModalFocusState, nextState: ModalFocusState diff --git a/ios/Temp/ModalEventManager/ModalFocusEventNotifiable.swift b/ios/Temp/ModalEventManager/ModalFocusEventNotifiable.swift index 1cdbe78..1a5e1ef 100644 --- a/ios/Temp/ModalEventManager/ModalFocusEventNotifiable.swift +++ b/ios/Temp/ModalEventManager/ModalFocusEventNotifiable.swift @@ -10,6 +10,7 @@ import Foundation public protocol ModalFocusEventNotifiable: AnyObject { func notifyForModalFocusStateChange( + forViewController viewController: UIViewController, prevState: ModalFocusState?, currentState: ModalFocusState, nextState: ModalFocusState @@ -22,6 +23,7 @@ public protocol ModalFocusEventNotifiable: AnyObject { public extension ModalFocusEventNotifiable { func notifyForModalFocusStateChange( + forViewController viewController: UIViewController, prevState: ModalFocusState?, currentState: ModalFocusState, nextState: ModalFocusState diff --git a/ios/Temp/ModalEventManager/ModalRegistryEntry.swift b/ios/Temp/ModalEventManager/ModalRegistryEntry.swift index 80e30ab..0f0b87c 100644 --- a/ios/Temp/ModalEventManager/ModalRegistryEntry.swift +++ b/ios/Temp/ModalEventManager/ModalRegistryEntry.swift @@ -35,6 +35,10 @@ public class ModalRegistryEntry { }; public func setModalFocusState(_ modalStateNext: ModalFocusState){ + guard let viewController = self.viewController else { + return; + }; + let modalStatePrev = self.modalFocusStatePrev; let modalStateCurrent = self.modalFocusState; @@ -47,6 +51,7 @@ public class ModalRegistryEntry { if let eventDelegate = self.viewController as? ModalFocusEventNotifiable { eventDelegate.notifyForModalFocusStateChange( + forViewController: viewController, prevState: modalStatePrev, currentState: modalStateCurrent, nextState: modalStateNext diff --git a/ios/Temp/ModalViewControllerLifecycleNotifier.swift b/ios/Temp/ModalViewControllerLifecycleNotifier.swift index 40d51e8..8d9a2db 100644 --- a/ios/Temp/ModalViewControllerLifecycleNotifier.swift +++ b/ios/Temp/ModalViewControllerLifecycleNotifier.swift @@ -164,12 +164,14 @@ open class ModalViewControllerLifecycleNotifier: ViewControllerLifecycleNotifier extension ModalViewControllerLifecycleNotifier: ModalFocusEventNotifiable { public func notifyForModalFocusStateChange( + forViewController viewController: UIViewController, prevState: ModalFocusState?, currentState: ModalFocusState, nextState: ModalFocusState ) { self.modalFocusEventDelegates.invoke { $0.notifyForModalFocusStateChange( + forViewController: viewController, prevState: prevState, currentState: currentState, nextState: nextState