Skip to content

Commit

Permalink
⭐️ Impl: RNIModalManager.getModalInstance
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Apr 12, 2023
1 parent ca49293 commit ea19099
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions ios/src_library/React Native/RNIModal/RNIModalManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,19 @@ public class RNIModalManager {
};
};

public func getModalInstance(
forPresentedViewController viewController: UIViewController
) -> (any RNIModal)? {
let presentingModal = self.modalInstances.first {
$0.modalViewController === viewController;
};

guard let presentingVC = presentingModal?.modalViewController
else { return nil };

return self.getModalInstance(forPresentingViewController: presentingVC);
};

public func getModalInstances(
forWindow window: UIWindow
) -> [any RNIModal] {
Expand Down

0 comments on commit ea19099

Please sign in to comment.