react-navigation / react-navigation/react-navigation
UnhandledLinkingContext throws while linking is not ready (!isLinkingReady branch omits providers)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 24.5k
- Forks
- 5.1k
- Avg merge
- 1d 5h
- Merged PRs (30d)
- 18
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in lib/module/NavigationContainer.js at the !isLinkingReady early-return branch, then compare it with the main return path and its UnhandledLinkingContext.Provider and LinkingContext.Provider values. Ensure the fallback uses the same linking-related providers and remains inside ThemeProvider; done means consumers no longer hit the throwing default context during pre-resolution renders.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react-native, typescript
- Domain
- mobile
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 84/100