fix(ios): popover delegate should ignore non-native views (#10609)

This commit is contained in:
Eduardo Speroni
2024-08-29 13:29:49 -03:00
committed by GitHub
parent 73f9827d31
commit ba3316e749

View File

@@ -1002,7 +1002,11 @@ export class View extends ViewCommon implements ViewDefinition {
const popoverPresentationController = controller.popoverPresentationController;
this._popoverPresentationDelegate = IOSHelper.UIPopoverPresentationControllerDelegateImp.initWithOwnerAndCallback(new WeakRef(this), this._closeModalCallback);
popoverPresentationController.delegate = <UIPopoverPresentationControllerDelegate>this._popoverPresentationDelegate;
const view = parent.nativeViewProtected;
let view: UIView;
do {
view = parent.nativeViewProtected;
parent = parent.parent as View;
} while (parent && !view);
// Note: sourceView and sourceRect are needed to specify the anchor location for the popover.
// Note: sourceView should be the button triggering the modal. If it the Page the popover might appear "behind" the page content
popoverPresentationController.sourceView = view;