feat(iOS, FormSheet v5): Add support for preventNativeDismiss & onNativeDismissPrevented#4022
Open
t0maboro wants to merge 8 commits into
Open
feat(iOS, FormSheet v5): Add support for preventNativeDismiss & onNativeDismissPrevented#4022t0maboro wants to merge 8 commits into
t0maboro wants to merge 8 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends the experimental Gamma FormSheet (Fabric/iOS) implementation with a preventNativeDismiss prop to block user-initiated dismiss (swipe-down + backdrop tap), and introduces an onNativeDismissPrevented event so JS can react to blocked dismissal attempts.
Changes:
- Added
preventNativeDismissto the FormSheet JS API and Fabric native component props. - Added
onNativeDismissPreventedevent plumbing (codegen prop → C++ event emitter → ObjC++ event emitter → JS). - Implemented iOS native prevention via
UIAdaptivePresentationControllerDelegateand a custom backdropUITapGestureRecognizer, plus added an SFT scenario for manual validation.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/fabric/gamma/modals/form-sheet/FormSheetHostNativeComponent.ts | Adds codegen prop/event definitions for preventNativeDismiss + onNativeDismissPrevented. |
| src/components/gamma/modals/form-sheet/FormSheet.types.ts | Exposes the new prop + event in the public TS types/docs. |
| ios/gamma/modals/form-sheet/RNSFormSheetHostEventEmitter.mm | Emits onNativeDismissPrevented to JS when dismissal is blocked. |
| ios/gamma/modals/form-sheet/RNSFormSheetHostEventEmitter.h | Declares emitOnNativeDismissPrevented. |
| ios/gamma/modals/form-sheet/RNSFormSheetHostComponentView.mm | Tracks preventNativeDismiss prop and forwards it to the controller; emits prevented event via delegate callback. |
| ios/gamma/modals/form-sheet/RNSFormSheetContentController.mm | Implements presentationControllerShouldDismiss / ...DidAttemptToDismiss and backdrop-tap interception via gesture recognizer. |
| ios/gamma/modals/form-sheet/RNSFormSheetContentController.h | Adds delegate method + preventNativeDismiss property. |
| apps/src/tests/single-feature-tests/form-sheet/test-form-sheet-prevent-native-dismiss-ios/scenario.md | Adds manual test scenario documentation for the new behavior. |
| apps/src/tests/single-feature-tests/form-sheet/test-form-sheet-prevent-native-dismiss-ios/index.tsx | Adds an SFT screen to exercise the new prop/event. |
| apps/src/tests/single-feature-tests/form-sheet/index.ts | Registers the new SFT scenario in the FormSheet group. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
9eebb45 to
7efa595
Compare
322ae24 to
804c8c7
Compare
kligarski
reviewed
May 18, 2026
Contributor
kligarski
left a comment
There was a problem hiding this comment.
Screen.Recording.2026-05-18.at.17.53.06.mov
might be related to missing detachBackdropTapGestureRecognizer call
| } | ||
| } | ||
|
|
||
| - (void)detachBackdropTapGestureRecognizer |
Contributor
There was a problem hiding this comment.
This isn't used right now - should it be?
LKuchno
reviewed
May 20, 2026
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
804c8c7 to
ad4e555
Compare
Co-authored-by: Krzysztof Ligarski <63918941+kligarski@users.noreply.github.com>
LKuchno
approved these changes
May 20, 2026
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.
Description
Adds
preventNativeDismisssupport. WhenpreventNativeDismissistrue, the user cannot dismiss the sheet natively via swipe-down or by tapping the backdrop. Programmatic dismissal from JS still works.When dismissal is prevented, the sheet emits a new
onNativeDismissPreventedevent so JS can react.Note
Backdrop taps need extra handling because UIKit doesn't fire delegate callbacks for this path. I follow the same approach as in #3771 with attaching a
UITapGestureRecognizerto the presentation controller'scontainerViewand filter touches, so only taps outsidepresentedVieware recognized. The recognizer is attached/detached inviewWillAppear/viewDidDisappear, because UIKit recreates the container view on every present cycle.Closes: https://github.com/software-mansion/react-native-screens-labs/issues/1272
Changes
preventNativeDismissproponNativeDismissPreventedeventUITapGestureRecognizerfor backdrop taps.presentationControllerShouldDismiss,presentationControllerDidAttemptToDismissVisual documentation
preventnativedismiss.mov