core: `react` peer dependency fails strict installs for renderers that alias `react` (Lynx)
Current behavior
@react-navigation/core (and use-latest-callback through it) declares react as a peer dependency. Non-React-Native renderers built on core do not install react: @react-navigation/lynx runs on ReactLynx (@lynx-js/react) and maps the react specifier onto a compat entry in the bundler, so no package named react ever exists in the app.
pnpm's default auto-install-peers hides this by installing an unused react. With strict-peer-dependencies and auto-install-peers=false the install fails:
ERR_PNPM_PEER_DEP_ISSUES Unmet peer dependencies
└─┬ @react-navigation/lynx 0.4.0-canary-20260910-b29e3a12
└─┬ @react-navigation/core 8.0.0-alpha.34
├── ✕ missing peer react@">= 19.2.0"
└─┬ use-latest-callback 0.3.5
└── ✕ missing peer react@>=16.8Expected behavior
An app on a renderer that provides react through an alias can install @react-navigation/core without pnpm reporting a missing peer. Two options that would work:
- mark
reactas optional inpeerDependenciesMetafor@react-navigation/core(the import is still there, only the install-time check relaxes), or - document
peerDependencyRules.ignoreMissing: ['react']as the supported setup for such renderers, if you would rather keep the peer strict.
Happy to send a PR for either.
Reproduction
mkdir consumer && cd consumer
printf '{"name":"consumer","private":true,"dependencies":{"@react-navigation/lynx":"canary","@lynx-js/react":"^0.126.0","lynx-screens":"latest"}}\n' > package.json
pnpm install --strict-peer-dependencies --config.auto-install-peers=falseThe same install passes with pnpm's defaults, because pnpm auto-installs [email protected] that nothing imports.
Platform
- Android
- iOS
- Web
- Windows
- MacOS
- Other: Lynx (
@react-navigation/lynx, https://github.com/react-navigation/react-navigation-lynx)
Packages
-
@react-navigation/core
Environment
| package | version |
|---|---|
| @react-navigation/core | 8.0.0-alpha.34 |
| @react-navigation/lynx | 0.4.0-canary-20260910-b29e3a12 |
| @lynx-js/react | 0.126.0 |
| lynx-screens | latest |
| pnpm | 10.30.3 / 11.13.1 |
| node | 24.20.0 |
Source: react-navigation/react-navigation