Skip to content

Commit

Permalink
💫 Update: UIViewController._swizzled_dismiss
Browse files Browse the repository at this point in the history
Summary: Update `UIViewController._swizzled_dismiss` to use `RNIModalWrapper`, and integrate w/ `RNIModalManager`.
  • Loading branch information
dominicstop committed Apr 12, 2023
1 parent 6f81967 commit c15a509
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions ios/src_library/Helpers+Utilities/UIViewController+Swizzling.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,15 @@ extension UIViewController {
);
#endif

let presentingModal = RNIModalManagerShared.getModalInstance(
forPresentingViewController: self
) as? RNIModalViewControllerWrapper;

if let presentingModal = presentingModal {
presentingModal.modalPresentationNotificationDelegate
.notifyOnModalWillHide(sender: presentingModal);
};

// call original impl.
self._swizzled_dismiss(animated: flag) {
#if DEBUG
Expand All @@ -89,6 +98,12 @@ extension UIViewController {
+ " - completion invoked"
);
#endif

if let presentingModal = presentingModal {
presentingModal.modalPresentationNotificationDelegate
.notifyOnModalDidHide(sender: presentingModal);
};

completion?();
};
};
Expand Down

0 comments on commit c15a509

Please sign in to comment.