Skip to content

fix(presets): navigation link props, prevent-remove context, builder helpers and header height match React Navigation 7 - #865

Merged
danfry1 merged 15 commits into
mainfrom
fix/navigation-preset-gaps
Nov 15, 2026
Merged

danfry1 merged 15 commits into
mainfrom
fix/navigation-preset-gaps

Conversation

@danfry1

@danfry1 danfry1 commented Nov 14, 2026 •

Copy link
Copy Markdown
Owner

Summary

The navigation preset's useLinkProps, usePreventRemoveContext, useNavigationBuilder and native-stack useAnimatedHeaderHeight return what React Navigation 7 returns. Fixes #828.

Why

useLinkProps() returned accessibilityRole where React Navigation 7.5 returns role. usePreventRemoveContext() returned null where the library declares an object. useNavigationBuilder().navigation had no emit. useAnimatedHeaderHeight was missing from native-stack, so a screen using it failed with "is not a function".

Changes

  • useLinkProps() returns role: "link".
  • usePreventRemoveContext() returns the provided context, or an empty one.
  • useNavigationBuilder().navigation is its own helpers object: useNavigation()'s mock functions plus an emit that returns React Navigation's event object. It stays the same across renders.
  • useAnimatedHeaderHeight() returns an Animated.Value from the engine's React Native (presets/active-react-native.ts), kept across renders. It starts where native-stack starts a card screen's header: 44 on an iOS phone, 56 on Android, with no top inset.
  • useHeaderHeight() and HeaderHeightContext's default give that same height, as native-stack seeds its animated height from it.
  • getDefaultHeaderHeight() from @react-navigation/elements is the library's formula (platform, orientation, modal, status bar) instead of a constant 64.
  • Removes the four Navigation preset: useLinkProps role, usePreventRemoveContext and useAnimatedHeaderHeight differ from React Navigation 7 #828 conformance waivers under each engine. Adds a bug museum exhibit, pre-828-native-stack-animated-header-height.

Notes

  • Minor changeset: a snapshot of a link built from useLinkProps changes, and so does a test that expected null from usePreventRemoveContext().

@danfry1 danfry1 added this to the 0.16.0 milestone Nov 14, 2026
@danfry1 danfry1 added bug Something isn't working area:presets Built-in presets and libraries' own mocks labels Nov 14, 2026
@danfry1

danfry1 commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Land order: #853 merges before this PR. #829 is already on main. Once #853 has landed, this branch needs main merged in; it currently has conflicts.

…-gaps

# Conflicts:
#	packages/vitest-native/src/presets/navigation.ts
#	packages/vitest-native/tests-native/conformance/native-stack.mock-waivers.json
#	packages/vitest-native/tests-native/conformance/native-stack.waivers.json
#	packages/vitest-native/tests-native/conformance/navigation.mock-waivers.json
#	packages/vitest-native/tests-native/conformance/navigation.waivers.json
#	packages/vitest-native/tests/presets.test.ts
#	packages/vitest-native/validation/bug-museum/exhibits.json
The merge of main brought back the branch's copy of it after the 0.15.1 version PR consumed it.
@danfry1

danfry1 commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Adversarial review: PASS at e302ac2. Each #828 criterion has a test that fails on main, and the mocked shapes match the installed React Navigation 7 sources (native 7.5.1, core 7.24.0, elements 2.9.45, native-stack 7.21.0). The merge resolution and the single changeset are correct. Header-height gaps that predate or sit outside this change (platform read time, HeaderHeightContext provider, safe-area inset, useAnimatedHeaderHeight context) are tracked in #889.

@danfry1
danfry1 merged commit 5d237e3 into main Nov 15, 2026
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:presets Built-in presets and libraries' own mocks bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Navigation preset: useLinkProps role, usePreventRemoveContext and useAnimatedHeaderHeight differ from React Navigation 7

1 participant