Skip to content

refactor(test): Add scenario for Stack v5 preventNativeDismiss with nested stack#4279

Merged
LKuchno merged 11 commits into
mainfrom
@lkuchno/test-stack-prevent-native-dismiss-nested-stack
Jul 17, 2026
Merged

refactor(test): Add scenario for Stack v5 preventNativeDismiss with nested stack#4279
LKuchno merged 11 commits into
mainfrom
@lkuchno/test-stack-prevent-native-dismiss-nested-stack

Conversation

@LKuchno

@LKuchno LKuchno commented Jul 7, 2026

Copy link
Copy Markdown
Collaborator

Description

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

Adds a comprehensive manual test scenario for the test-stack-prevent-native-dismiss-nested-stack gamma/v5 Stack test screen, which exercises preventNativeDismiss across a Stack nested inside another Stack. It also renames the test directory to follow the repo's test-* naming convention.

The scenario documents the Android-only behavior across both flag states:

  • Enabled — native dismissal (the native header back-button chevron and the system gesture-back / edge swipe) is intercepted, each screen fires its own distinct toast (Native dismiss prevented - B / - NestedHome / - NestedB), and the screen stays put — including at the root of the nested stack, where interception blocks exiting back into the parent stack.
  • Disabled — native back pops normally: a non-root screen pops within its own stack, and the nested root pops the whole nested stack back into the parent.
  • The on-screen Pop button always pops regardless of the flag, including the container-level bubbling that pops the nested stack out of the parent.
  • Layered prevention — when several ancestors prevent at once (e.g. B below NestedStackNestedHome), only the current top screen intercepts, confirmed by which toast appears.

To exercise the native-back / gesture-back flows on Android, the scenario uses the direct launch: the screen is rendered as the root component via apps/App.tsx (TestStackPreventNativeDismissNestedStack as Example). With the gamma StackContainer at the root, native back and gesture-back interact with the stack directly, which works around #1459 (where, when nested inside the example app's own navigation, native back navigates out to the system menu instead of popping). This replaces the earlier limitation where disabled-flag native-back steps had to be deferred — they are now covered.

Android-only feature; the scenario is not runnable on iOS.

Changes

  • Stack v5, test organization: Renamed the test directory from prevent-native-dismiss-nested-stack/ to test-stack-prevent-native-dismiss-nested-stack/ (aligns with the test-* convention) and updated its registration/import paths in apps/src/tests/single-feature-tests/stack-v5/index.ts.
  • Stack v5, manual test scenario: Added scenario.md for preventNativeDismiss across nested Stack containers: direct-launch Android setup, enabled-state interception (header chevron + gesture-back) at outer, nested-root, and nested non-root screens, disabled-state native-back pop (within-stack and nested-root bubbling), the always-works on-screen Pop, runtime flag toggling, and a layered-prevention edge case across nesting levels. The #1459 direct-launch workaround is documented in the scenario's Note.

@LKuchno
LKuchno marked this pull request as draft July 7, 2026 05:48
@LKuchno
LKuchno requested a review from Copilot July 7, 2026 05:58

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

Adds a new Stack v5 manual-test scenario screen to the example app for validating preventNativeDismiss behavior in a nested stack setup on Android, and wires it into the Stack v5 single-feature test registry.

Changes:

  • Added a new Stack v5 scenario screen implementing an outer stack + nested stack configuration with toasts and a runtime toggle for preventNativeDismiss.
  • Added a comprehensive manual test scenario.md describing expected behavior and step-by-step validation across nested stack levels.
  • Updated the Stack v5 scenario registry import/export to point at the renamed test-stack-prevent-native-dismiss-nested-stack directory.

Reviewed changes

Copilot reviewed 2 out of 4 changed files in this pull request and generated 2 comments.

File Description
apps/src/tests/single-feature-tests/stack-v5/test-stack-prevent-native-dismiss-nested-stack/scenario.md Adds a detailed manual test scenario for nested-stack native dismiss prevention behavior.
apps/src/tests/single-feature-tests/stack-v5/test-stack-prevent-native-dismiss-nested-stack/scenario-description.ts Introduces scenario metadata (name/key/platforms/e2eCoverage).
apps/src/tests/single-feature-tests/stack-v5/test-stack-prevent-native-dismiss-nested-stack/index.tsx Implements the nested-stack test UI and behaviors (toasts + toggling).
apps/src/tests/single-feature-tests/stack-v5/index.ts Updates scenario registry imports/exports to the renamed scenario directory.

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

@LKuchno LKuchno added platform:android Issue related to Android part of the library area:stack-v5 Issues related to Native Stack v5 implementation labels Jul 7, 2026
@LKuchno
LKuchno marked this pull request as ready for review July 7, 2026 07:49
…610e

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@LKuchno
LKuchno requested a review from kkafar July 7, 2026 08:10
@LKuchno
LKuchno marked this pull request as draft July 7, 2026 08:57
@LKuchno LKuchno changed the title chore(test): Add scenario for Stack v5 preventNativeDismiss with nested stack refactor(test): Add scenario for Stack v5 preventNativeDismiss with nested stack Jul 7, 2026
@LKuchno
LKuchno marked this pull request as ready for review July 7, 2026 12:38
…ns into @lkuchno/test-stack-prevent-native-dismiss-nested-stack
@LKuchno
LKuchno merged commit f325544 into main Jul 17, 2026
3 checks passed
@LKuchno
LKuchno deleted the @lkuchno/test-stack-prevent-native-dismiss-nested-stack branch July 17, 2026 14:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:stack-v5 Issues related to Native Stack v5 implementation platform:android Issue related to Android part of the library

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants