Skip to content

feat(iOS, FormSheet v5): Emit onDismiss event when dismissed from JS#4124

Open
t0maboro wants to merge 1 commit into
mainfrom
@t0maboro/add-on-dismiss-event
Open

feat(iOS, FormSheet v5): Emit onDismiss event when dismissed from JS#4124
t0maboro wants to merge 1 commit into
mainfrom
@t0maboro/add-on-dismiss-event

Conversation

@t0maboro

@t0maboro t0maboro commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Description

Adding onDismiss event, which will be fired when the sheet is dismissed programmatically from JS via toggling isOpen prop to false.

Closes: https://github.com/software-mansion/react-native-screens-labs/issues/1268

Changes

  • updated spec
  • updated public API
  • added native implementation

Before & after - visual documentation

iOS 26
ios25.mov

Test plan

Added dedicated SFT

Checklist

  • Included code example that can be used to test this change.
  • For visual changes, included screenshots / GIFs / recordings documenting the change.
  • For API changes, updated relevant public types.
  • Ensured that CI passes

@t0maboro t0maboro changed the base branch from main to @t0maboro/formsheet-events June 2, 2026 14:25
@t0maboro t0maboro changed the title @t0maboro/add on dismiss event feat(iOS, FormSheet v5): Emit onDismiss event when dismissed from JS Jun 2, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds a new onDismiss callback to the experimental FormSheet API to notify JS when the sheet has been dismissed programmatically (by toggling isOpen to false). This helps consumers distinguish JS-driven dismissal from user-driven native gesture dismissal (onNativeDismiss).

Changes:

  • Extended the Fabric/codegen spec and public TypeScript types to include onDismiss.
  • Implemented iOS native emission of onDismiss when the sheet is dismissed via the presentation manager.
  • Added a dedicated iOS single-feature-test scenario to validate onDismiss vs onNativeDismiss.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/fabric/gamma/modals/form-sheet/FormSheetHostNativeComponent.ts Adds onDismiss to the codegen native component event props.
src/components/gamma/modals/form-sheet/FormSheet.types.ts Exposes onDismiss in the public FormSheetProps API with docs.
ios/gamma/modals/form-sheet/RNSFormSheetPresentationManager.mm Triggers a delegate callback after programmatic dismissal completes.
ios/gamma/modals/form-sheet/RNSFormSheetHostEventEmitter.mm Implements native emission for the new onDismiss event.
ios/gamma/modals/form-sheet/RNSFormSheetHostEventEmitter.h Declares the new emitOnDismiss method.
ios/gamma/modals/form-sheet/RNSFormSheetHostComponentView.mm Implements sheetControllerDidDismiss and forwards to the event emitter.
ios/gamma/modals/form-sheet/RNSFormSheetContentController.h Extends the delegate protocol with sheetControllerDidDismiss.
apps/src/tests/single-feature-tests/form-sheet/test-form-sheet-dismiss-events-ios/scenario.md Adds a manual test scenario covering both dismiss event types.
apps/src/tests/single-feature-tests/form-sheet/test-form-sheet-dismiss-events-ios/scenario-description.ts Registers metadata for the new SFT scenario.
apps/src/tests/single-feature-tests/form-sheet/test-form-sheet-dismiss-events-ios/index.tsx Implements the test screen UI and logging for dismiss events.
apps/src/tests/single-feature-tests/form-sheet/index.ts Adds the new dismiss-events scenario to the FormSheet scenario group.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@LKuchno LKuchno left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea to put an event logs area on the screen! :)

Base automatically changed from @t0maboro/formsheet-events to main June 9, 2026 10:35
@t0maboro t0maboro force-pushed the @t0maboro/add-on-dismiss-event branch from 253054a to 2ec6bdd Compare June 9, 2026 10:58

@kligarski kligarski left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants