Skip to content

Repository files navigation

Unique-screen stack repro (New Architecture)

Minimal React Native app that contrasts:

  1. Bug (getId)ScreenB / ScreenC use a constant getId. Navigating to an identity that already exists reorders the same route.key. On native stack (react-native-screens) that reorder can leave a screen frozen (no touches).
  2. Fixed (unique) — same screens, no getId. A UniqueNavigationProvider wraps navigate so mid-stack duplicates are removed with an atomic reset that appends a new route (new key).

Based on the handoff in ../unique-stack-navigation-handoff.md.

Stack under each tab

ScreenA → ScreenB → ScreenC

Each screen has Open next and Go back. ScreenC also has Open ScreenB again (trigger).

Repro steps (Bug tab)

  1. Open the Bug (getId) tab.
  2. ScreenA → ScreenB → ScreenC.
  3. Tap Open ScreenB again (trigger).
  4. Watch the stack summary: ScreenB’s key tail should stay the same (reorder, not a new route).
  5. Tap Go back.
  6. Expected bug: ScreenC is frozen / unresponsive to touches.

Verify fix (Fixed tab)

  1. Open the Fixed (unique) tab.
  2. Same path: ScreenA → ScreenB → ScreenC → Open ScreenB again.
  3. Stack summary should show ScreenB with a new key tail; ScreenC is gone from history.
  4. Go back to ScreenA — screens stay interactive.

Run

Requires Node ≥ 22.11.

cd rn-new-arch-unique-screen-repro
yarn
yarn start
# other terminal:
yarn ios
# or
yarn android
REC-20260717104210.mp4

Layout

Path Role
src/navigation/uniqueScreenIds.ts Stack identity IDs config
src/navigation/uniqueStackNavigate.ts Unique-stack navigate algorithm
src/utils/routeHelpers.ts / stackHelpers.ts Param/identity + stack walk helpers
src/contexts/UniqueNavigationContext.tsx Provider + useUniqueNavigation
src/hooks/useAppNavigation.ts Wrapped navigate for screens
src/hooks/useStackSummary.ts Stack name + key-tail summary
src/navigation/navigators/ Root tabs, bug stack (getId), fixed stack
src/screens/ ScreenA / ScreenB / ScreenC + shared DemoScreen UI

Related: react-native-screens#2575, react-native-screens#2578.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages