react / react/react-native

react-native@0.85.3 peerDependencies allow react@19.2.6 but embedded renderer requires exact 19.2.3

未关闭
#57,079 2 条评论 4 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Needs: Attention Needs: Repro
主要语言
C++
星标
127k
派生
25.3k
平均合并
1 天 23 小时
30 天内合并 PR
4

描述

Description

react-native@0.85.3 declares this peer dependency:

{
  "react": "^19.2.3"
}

That allows package managers to install react@19.2.6, but the embedded React Native renderer in the same package appears to require react@19.2.3 exactly at runtime.

In Libraries/Renderer/implementations/ReactNativeRenderer-dev.js from react-native@0.85.3:

var isomorphicReactPackageVersion = React.version;
if ("19.2.3" !== isomorphicReactPackageVersion)
  throw Error(
    'Incompatible React versions: The "react" and "react-native-renderer" packages must have the exact same version. Instead got:\n  - react:                  ' +
      (isomorphicReactPackageVersion +
        "\n  - react-native-renderer:  19.2.3\nLearn more: https://react.dev/warnings/version-mismatch")
  );

The renderer internals also report:

version: "19.2.3",
rendererPackageName: "react-native-renderer",
reconcilerVersion: "19.2.3"

So the install-time contract says react@19.2.6 is acceptable, while the runtime contract rejects it.

Steps to reproduce
  1. Install react-native@0.85.3.
  2. Install react@19.2.6 and react-dom@19.2.6.
  3. Launch a React Native app.
Expected behavior

The package metadata should prevent installing a React version that the embedded renderer will reject at runtime, or tooling/docs should make this exact-version requirement explicit enough to catch before app launch.

For example, one of these would avoid the mismatch:

  • narrow react-native@0.85.3's peerDependencies.react to the exact renderer-compatible version, 19.2.3, or
  • add install/doctor guidance that react must exactly match the embedded react-native-renderer version, not just satisfy the semver peer range.
Actual behavior

react@19.2.6 satisfies ^19.2.3, but the app fails at runtime because the embedded react-native-renderer is 19.2.3.

Environment

Observed from package contents:

{
  "reactNativeVersion": "0.85.3",
  "reactPeer": "^19.2.3",
  "rendererCheck": "19.2.3",
  "rendererVersion": "19.2.3"
}

This came up in a pnpm monorepo where web packages resolve react@19.2.6 and an Expo/RN mobile app correctly needs react@19.2.3. The monorepo context made the mismatch more visible, but the underlying issue seems to be that the package metadata permits a React patch version that the renderer rejects.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

将包元数据中的 react 对等依赖项与 Libraries/Renderer/implementations/ReactNativeRenderer-dev.js 中的精确版本检查进行比较。使用 react@19.2.6 重现安装,然后确定包契约或指导是否应阻止运行时不匹配;完成标准是,在应用启动前拒绝受支持的 React 版本,或明确识别这些版本。

由索引模型根据 Issue 内容生成。

评估

技术栈
react-native
领域
mobile
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。