Skip to content

Commit

Permalink
💫 Update: RNIModal.synthesizedModalIndex
Browse files Browse the repository at this point in the history
Update RNIModal+Helpers.swift
  • Loading branch information
dominicstop committed Apr 6, 2023
1 parent 5b4b20e commit d5068e3
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions ios/src_library/React Native/RNIModal/RNIModal+Helpers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,18 @@ extension RNIModalState where Self: RNIModalPresentation {
};

/// Programmatically get the "modal index"
///
/// Note:2023-03-31-15-41-04
///
/// * This is based on the view controller hierarchy
/// * So parent/child view controller that aren't modals are also counted
///
var synthesizedModalIndex: Int {
let listPresentedVC =
RNIModalManager.getPresentedViewControllers(for: self.window);

for (index, vc) in listPresentedVC.enumerated() {
guard vc != self.modalViewController else { continue };
var index = -1;

for vc in listPresentedVC {
if vc.presentingViewController != nil {
index += 1;
};

guard vc === self.modalViewController else { continue };
return index;
};

Expand Down

0 comments on commit d5068e3

Please sign in to comment.