From 77c3a735b9939600edc3699418e94938331d8c43 Mon Sep 17 00:00:00 2001 From: Dominic Go <18517029+dominicstop@users.noreply.github.com> Date: Sat, 13 May 2023 13:12:58 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=AB=20Update:=20`RNIModalRequestable`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../React Native/RNIModal/RNIModal.swift | 16 +++++++------- .../RNIModalView/RNIModalView.swift | 22 +++++++++---------- .../RNIModalViewControllerWrapper.swift | 12 +++++----- 3 files changed, 24 insertions(+), 26 deletions(-) diff --git a/ios/src_library/React Native/RNIModal/RNIModal.swift b/ios/src_library/React Native/RNIModal/RNIModal.swift index 75dd9c53..bd90c2cd 100644 --- a/ios/src_library/React Native/RNIModal/RNIModal.swift +++ b/ios/src_library/React Native/RNIModal/RNIModal.swift @@ -46,16 +46,16 @@ public protocol RNIModalState: AnyObject { public protocol RNIModalRequestable: AnyObject { func requestModalToShow( - sender: any RNIModal, - onRequestApprovedBlock: () -> Void, - onRequestDeniedBlock: (_ reason: String) -> Void - ); + sender: Any, + animated: Bool, + completion: @escaping () -> Void + ) throws; func requestModalToHide( - sender: any RNIModal, - onRequestApprovedBlock: () -> Void, - onRequestDeniedBlock: (_ reason: String) -> Void - ); + sender: Any, + animated: Bool, + completion: @escaping () -> Void + ) throws; }; /// Contains functions that get called whenever a modal-related event occurs. diff --git a/ios/src_library/React Native/RNIModalView/RNIModalView.swift b/ios/src_library/React Native/RNIModalView/RNIModalView.swift index 28cd6c04..6a5493e8 100644 --- a/ios/src_library/React Native/RNIModalView/RNIModalView.swift +++ b/ios/src_library/React Native/RNIModalView/RNIModalView.swift @@ -1091,21 +1091,19 @@ extension RNIModalView: UISheetPresentationControllerDelegate { extension RNIModalView: RNIModalRequestable { public func requestModalToShow( - sender: any RNIModal, - onRequestApprovedBlock: () -> Void, - onRequestDeniedBlock: (String) -> Void - ) { - /// `TODO:2023-03-24-09-58-50` - Refactor `RNIModalView` to use `RNIModalManager`. - /// No-op - TBA + sender: Any, + animated: Bool, + completion: @escaping () -> Void + ) throws { + try self.presentModal(completion: completion); }; public func requestModalToHide( - sender: any RNIModal, - onRequestApprovedBlock: () -> Void, - onRequestDeniedBlock: (String) -> Void - ) { - /// `TODO:2023-03-24-09-58-50` - Refactor `RNIModalView` to use `RNIModalManager`. - /// No-op - TBA + sender: Any, + animated: Bool, + completion: @escaping () -> Void + ) throws { + try self.dismissModal(completion: completion); }; }; diff --git a/ios/src_library/React Native/RNIModalViewControllerWrapper/RNIModalViewControllerWrapper.swift b/ios/src_library/React Native/RNIModalViewControllerWrapper/RNIModalViewControllerWrapper.swift index 06ab89c7..9e7af367 100644 --- a/ios/src_library/React Native/RNIModalViewControllerWrapper/RNIModalViewControllerWrapper.swift +++ b/ios/src_library/React Native/RNIModalViewControllerWrapper/RNIModalViewControllerWrapper.swift @@ -76,17 +76,17 @@ public class RNIModalViewControllerWrapper: extension RNIModalViewControllerWrapper: RNIModalRequestable { public func requestModalToShow( - sender: any RNIModal, - onRequestApprovedBlock: () -> Void, - onRequestDeniedBlock: (String) -> Void + sender: Any, + animated: Bool, + completion: @escaping () -> Void ) { // TBA - no-op }; public func requestModalToHide( - sender: any RNIModal, - onRequestApprovedBlock: () -> Void, - onRequestDeniedBlock: (String) -> Void + sender: Any, + animated: Bool, + completion: @escaping () -> Void ) { // TBA - no-op };