Problem
While NavigationContainer is in the “linking not ready” path (!isLinkingReady), it only renders LocaleDirContext + core ThemeProvider + fallback. It does not mount UnhandledLinkingContext.Provider or LinkingContext.Provider.
UnhandledLinkingContext’s default value throws if anything accesses lastUnhandledLink or setLastUnhandledLink. That can surface as:
Error: Couldn't find an UnhandledLinkingContext context.
during that window or when the gate flips again (e.g. toggling appearance / re-renders with async linking, portaled UI inside the container, etc.).
Expected behavior
Whenever NavigationContainer mounts (including the pre-resolution fallback branch), the same linking-related context values that exist after isLinkingReady should be available so consumers never hit the default context that throws.
Suggested fix
In the !isLinkingReady return path, wrap fallback with the same UnhandledLinkingContext.Provider and LinkingContext.Provider (and values unhandledLinkingContext / linkingContext) as in the main return, then keep ThemeProvider + fallback inside that tree.
Environment
@react-navigation/native: 7.x (e.g. 7.1.26)
- React Native / Expo as applicable
Workaround
We applied a local patch-package change to lib/module/NavigationContainer.js to add those providers around the early-return branch.
Problem
While
NavigationContaineris in the “linking not ready” path (!isLinkingReady), it only rendersLocaleDirContext+ coreThemeProvider+fallback. It does not mountUnhandledLinkingContext.ProviderorLinkingContext.Provider.UnhandledLinkingContext’s default value throws if anything accesseslastUnhandledLinkorsetLastUnhandledLink. That can surface as:Error: Couldn't find an UnhandledLinkingContext context.during that window or when the gate flips again (e.g. toggling appearance / re-renders with async linking, portaled UI inside the container, etc.).
Expected behavior
Whenever
NavigationContainermounts (including the pre-resolutionfallbackbranch), the same linking-related context values that exist afterisLinkingReadyshould be available so consumers never hit the default context that throws.Suggested fix
In the
!isLinkingReadyreturn path, wrapfallbackwith the sameUnhandledLinkingContext.ProviderandLinkingContext.Provider(and valuesunhandledLinkingContext/linkingContext) as in the main return, then keepThemeProvider+fallbackinside that tree.Environment
@react-navigation/native: 7.x (e.g. 7.1.26)Workaround
We applied a local
patch-packagechange tolib/module/NavigationContainer.jsto add those providers around the early-return branch.