Skip to content

Commit

Permalink
🐞 Fix: ModalSheetView Focus Event (Again)
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Oct 2, 2024
1 parent 9a78129 commit 662932a
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions ios/Temp/ModalEventManager/ModalEventsManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -136,24 +136,29 @@ public final class ModalEventsManager {
let didDismiss =
modalVC.view.window == nil
|| !modalVC.isPresentedAsModal;

guard didDismiss else {
return;
};

let eventManager =
ModalEventsManagerRegistry.shared.getManager(forWindow: targetWindow);

let modalEntries = eventManager.modalRegistry.getEntriesGrouped();

modalEntries.topMostModal!.setModalFocusState(.blurred);
modalEntries.secondTopMostModal?.setModalFocusState(.focused);
modalEntries.topMostModal!.setModalFocusState(didDismiss
? .blurred
: .focused
);

modalEntries.secondTopMostModal?.setModalFocusState(didDismiss
? .focused
: .blurred
);

modalEntries.otherModals?.forEach {
$0.setModalFocusState(.blurred);
};

eventManager.modalRegistry.removeEntry(forViewController: modalVC);
if didDismiss {
eventManager.modalRegistry.removeEntry(forViewController: modalVC);
};
};
};

0 comments on commit 662932a

Please sign in to comment.