-
-
Notifications
You must be signed in to change notification settings - Fork 5.1k
Description
Current behavior
After upgrading React Navigation packages, our Legacy Architecture app crashes when navigating to screens inside nested navigators (bottom tab -> native stack), with runtime errors like:
Property 'WeakRef' doesn't exist- equivalent
WeakRefnot found / undefined errors
This appears tied to the @react-navigation/core@7.16.2 change:
"use a weak ref instead of mutating params to avoid errors when it's frozen"
In nested navigation flows where params are consumed, core now calls new WeakRef(route.params). In our runtime, typeof WeakRef === "undefined", so it hard-crashes.
A key point: this can happen even when app code pins an older @react-navigation/native line, because /native allows a semver range for /core and installs can resolve a newer /core that includes this behavior.
Observed behavior:
- root stack navigation may still work
- nested tab -> stack navigation paths crash
Expected behavior
React Navigation should not hard-crash if WeakRef is unavailable.
Expected fallback behavior:
- feature-detect
WeakRefbefore using it - use a safe fallback path when missing
This would avoid runtime breakages in environments where /core resolves to versions requiring WeakRef but runtime support is absent.
Reproduction
https://github.com/wuppious/react-navigation-weak-ref-repro
Platform
- Android
- iOS
- Web
- Windows
- MacOS
Environment
- I've removed the packages that I don't use
| package | version |
|---|---|
| @react-navigation/native | 7.2.1 |
| @react-navigation/bottom-tabs | 7.4.7 |
| @react-navigation/native-stack | 7.14.8 |
| react-native-screens | 4.16.0 |
| react-native-safe-area-context | 5.7.0 |
| react-native-gesture-handler | 2.28.0 |
| react-native | 0.81.5 |
| node | v23.9.0 |
| npm or yarn | npm 10.9.2 |
Additional resolved dependency detail (repro repo):
@react-navigation/coreresolved to7.17.1.
Additional environment detail:
Using React Native Legacy Architecture