Skip to content

Commit

Permalink
🛠 Refactor: Remove getPresentedVCList
Browse files Browse the repository at this point in the history
Summary: Remove `RNIModalView.getPresentedVCList` + usage.
  • Loading branch information
dominicstop committed Mar 27, 2023
1 parent ba25f5c commit 6ecdbf2
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions ios/src_library/React Native/RNIModalView/RNIModalView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -414,25 +414,6 @@ class RNIModalView: UIView, RNIModalFocusNotifying, RNIModalIdentity,
bridge.uiManager.setSize(newBounds.size, for: reactSubview);
};

private func getPresentedVCList() -> [UIViewController] {
guard let rootVC = UIWindow.key?.rootViewController else {
#if DEBUG
print("RNIModalView, getTopMostVC Error: could not get root VC. ");
#endif
return [];
};

var vcList: [UIViewController] = [];
vcList.append(rootVC);

// climb the vc hierarchy to find the topmost presented vc
while let presentedVC = vcList.last?.presentedViewController {
vcList.append(presentedVC);
};

return vcList;
};

private func enableSwipeGesture(_ flag: Bool? = nil){
self.modalVC?
.presentationController?
Expand All @@ -445,7 +426,8 @@ class RNIModalView: UIView, RNIModalFocusNotifying, RNIModalIdentity,
/// TODO:2023-03-22-12-07-54 - Refactor: Move to `RNIModalManager`
/// helper func to hide/show the other modals that are below level
private func setIsHiddenForViewBelowLevel(_ level: Int, isHidden: Bool){
let presentedVCList = self.getPresentedVCList();
let presentedVCList =
RNIModalManager.getPresentedViewControllers(for: self.window);

for (index, vc) in presentedVCList.enumerated() {
if index < level {
Expand Down

0 comments on commit 6ecdbf2

Please sign in to comment.