From b7c811c070d251b049c5b995c8ff5e782825c436 Mon Sep 17 00:00:00 2001 From: Arbli Troshani Date: Thu, 5 Nov 2026 01:06:49 +0100 Subject: [PATCH] fix(action-sheet,camera): show the Cancel action of action sheets on iPhone With Liquid Glass (iOS 26+), UIKit presents an action sheet anchored by setCenteredPopover as a popover on iPhone too, and popovers hide the .cancel action. Skip the anchor on iPhone when the sheet has a Cancel action. Without one, keep the popover: tapping outside it is what cancels the sheet on iOS 26+. Fixes #2630 --- .../ios/Sources/ActionSheetPlugin/ActionSheetPlugin.swift | 6 +++++- camera/ios/Sources/CameraPlugin/CameraPlugin.swift | 4 +++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/action-sheet/ios/Sources/ActionSheetPlugin/ActionSheetPlugin.swift b/action-sheet/ios/Sources/ActionSheetPlugin/ActionSheetPlugin.swift index 638de78eb1..3348840e88 100644 --- a/action-sheet/ios/Sources/ActionSheetPlugin/ActionSheetPlugin.swift +++ b/action-sheet/ios/Sources/ActionSheetPlugin/ActionSheetPlugin.swift @@ -44,7 +44,11 @@ public class ActionSheetPlugin: CAPPlugin, CAPBridgedPlugin, UIAdaptivePresentat DispatchQueue.main.async { [weak self] in if let alertController = self?.implementation.buildActionSheet(title: title, message: message, actions: alertActions) { - self?.setCenteredPopover(alertController) + // On iPhone, an anchored action sheet shows as a popover without its Cancel action (iOS 26+). + // Without a Cancel action, keep the popover: tapping outside it cancels. + if UIDevice.current.userInterfaceIdiom != .phone || !hasCancellableButton { + self?.setCenteredPopover(alertController) + } self?.bridge?.viewController?.present(alertController, animated: true) { if !hasCancellableButton { self?.setupCancelationListeners(alertController, call) diff --git a/camera/ios/Sources/CameraPlugin/CameraPlugin.swift b/camera/ios/Sources/CameraPlugin/CameraPlugin.swift index 251b8dd32f..c1507e0cf3 100644 --- a/camera/ios/Sources/CameraPlugin/CameraPlugin.swift +++ b/camera/ios/Sources/CameraPlugin/CameraPlugin.swift @@ -391,7 +391,9 @@ private extension CameraPlugin { alert.addAction(UIAlertAction(title: settings.userPromptText.cancelAction, style: .cancel, handler: { [weak self] (_: UIAlertAction) in self?.call?.reject("User cancelled photos app") })) - self.setCenteredPopover(alert) + if UIDevice.current.userInterfaceIdiom != .phone { + self.setCenteredPopover(alert) + } self.bridge?.viewController?.present(alert, animated: true, completion: nil) }