Skip to content

Commit 82d2352

Browse files
cipolleschimeta-codesync[bot]
authored andcommitted
Fix ActionSheet presented with an interactive background (#54179)
Summary: Pull Request resolved: #54179 iOS 26 changed how the `popoverPresentationController.sourceView`and the `popoverPresentationController.sourceRect` are handled by iOS. Before iOS 26, those two properties were ignored by iPhones but used by iPads. After iOS 26, those two properties are used by both iPhones and iPads. This introduced an issue where users presenting an action sheet were actually able to interact with the back button on iPhone even ehwn they were not supposed to. This change adds a condition over the idiom used (iPhone/iPad) to make sure that we use the anchors only with the iPad idions as it used to be before. ## Changelog: [iOS][Fixed] - Revert action sheet behavior not to break apps on iOS 26 Reviewed By: RSNara Differential Revision: D84842625 fbshipit-source-id: 347dfc21ee478abd02ba26078cb27d05e9cb64c5
1 parent be4fcda commit 82d2352

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

packages/react-native/React/CoreModules/RCTActionSheetManager.mm

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,18 @@ - (void)presentViewController:(UIViewController *)alertController
5858
} else {
5959
alertController.popoverPresentationController.permittedArrowDirections = 0;
6060
}
61-
alertController.popoverPresentationController.sourceView = sourceView;
62-
alertController.popoverPresentationController.sourceRect = sourceView.bounds;
61+
62+
if ([UIDevice.currentDevice userInterfaceIdiom] == UIUserInterfaceIdiomPad) {
63+
// These information only make sense for iPad, where the action sheet needs
64+
// to be presented from a specific anchor point.
65+
// Before iOS 26, if these information were passed on an iOS app, the action sheet
66+
// was ignoring them. after iOS 26, they are took into consideration and the
67+
// sheet behavior changes, for example the user can interact with the background
68+
// By applying these informations only to the iPad use case, we revert to the previous
69+
// behavior.
70+
alertController.popoverPresentationController.sourceView = sourceView;
71+
alertController.popoverPresentationController.sourceRect = sourceView.bounds;
72+
}
6373
[parentViewController presentViewController:alertController animated:YES completion:nil];
6474
}
6575

0 commit comments

Comments
 (0)