Repository navigation
Conversation
On iOS 26 an iPhone action sheet without a source view is shown centred like an alert, and the anchor option of ActionSheetIOS.showActionSheetWithOptions is ignored on iPhone since 82d2352 because an anchored popover lets the background receive touches. Use the anchor on iOS 26 iPhones when one is passed, and cover the window with a transparent control while the anchored sheet is shown, so a tap outside dismisses the sheet (selecting the cancel button) instead of pressing the view under it. An anchor that is no longer in a window falls back to the unanchored presentation.
|
@Abbondanzo has imported this pull request. If you are a Meta employee, you can view this in D133248161. |
Abbondanzo
requested changes
Nov 19, 2026
Abbondanzo
left a comment
Contributor
There was a problem hiding this comment.
A few suggestions and a retain cycle fix required
- Break the self -> handler -> self cycle with a weak reference. - Remove an old shield before presenting, and add the shield in the same place for both sheets. - Anchored share sheets get the shield too; an outside tap reports completed: false once. - Keep the shield while the share sheet stays open after backing out of an activity. - Add the shield to the presenting window, iPhone only; iPad keeps UIKit's popover behaviour. - Hide the shield from accessibility.
Visual regressionNo visual differences at android: no capture |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
On iOS 26 an action sheet without a source view opens in the middle of the screen, like an alert.
ActionSheetIOShas ananchoroption to open it from the tapped button or row, but on iPhone it's ignored.That was done on purpose in #54179: on iOS 26 an anchored popover lets the tap that closes it go through to the view behind, so tapping outside the sheet also pressed something else. #56200 reports the same for the share sheet.
This PR uses
anchoron iOS 26 iPhones and blocks that tap instead. While the sheet is open, a transparent view covers the window under it. Tapping it closes the sheet and returns the cancel index, like UIKit does, and nothing behind gets pressed. If the anchor view is already gone from the window, the sheet opens centered as before.Apart from that fallback, nothing changes without
anchoror before iOS 26. On iPad with iOS 26 the anchored sheet gets the same cover.Motivation:
The centered sheet looks like an alert and feels out of place in a native app. Apple's apps (Mail, Files, Photos) and apps like ChatGPT open these menus from the button or row you tapped. With this, RN apps get the same by passing
anchor, which they already do for iPad.Changelog:
[IOS] [FIXED] - ActionSheetIOS: open the sheet from
anchoron iOS 26 iPhones and stop the tap outside it from pressing the view behindTest Plan:
RNTester > ActionSheetIOS on an iPhone 17 Pro simulator, iOS 26.2.
We use the same change as a patch-package patch in production (RN 0.88.1): list rows open their action sheet from the row on iPhone and iPad, iOS 18 and 26, with no issues.
action-sheet-anchor-before.mp4
action-sheet-anchor-after.mp4