Pin react peerDependency to the exact synced renderer version - #58298
Pin react peerDependency to the exact synced renderer version#58298ram-devv1 wants to merge 1 commit into
Conversation
Fixes react#57079. The ^19.2.3 peer range lets package managers install a React that the embedded renderer rejects at runtime. Pin the peer to the exact synced version and add a monorepo test keeping peer, dev pin, and renderer bundle in sync.
|
Hi @ram-devv1! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks! |
Summary:
Fixes #57079.
react-native@0.85.3declares"react": "^19.2.3"inpeerDependencies, so package managers happily install e.g.react@19.2.6— but the embedded renderer only supports the exact React version it was synced with (the 0.85.x Paper bundle throwsIncompatible React versionsunlessReact.version === "19.2.3", and the Fabric bundle still embeds a pinnedversion: "19.2.3"). Install succeeds, launch crashes.This PR pins
packages/react-native/package.jsonpeerDependencies.reactto the exact synced version (19.2.3, matching the workspace-root dev pin, the helloworld template, and the renderer bundle), restoring the pre-0.76 exact-pin practice (0.74.0 shipped"react": "18.2.0"). A mismatched React now surfaces as an install-time peer warning instead of a runtime crash. It also adds a monorepo consistency test so future React syncs cannot silently reintroduce the drift.Changelog:
[GENERAL] [FIXED] - Pin
react-nativepeerDependency onreactto the exact synced renderer version so installs reject React versions the renderer does not support (fixes #57079)Test Plan:
yarn jest scripts/monorepo-tests/__tests__/check-packages-test.js— 6/6 pass, including the newthe react-native peer for react must exactly match the synced renderer versiontest.^19.2.3and re-ran the new test — it fails as expected; re-applied the fix and it passes.yarn eslint --max-warnings 0 scripts/monorepo-tests/__tests__/check-packages-test.js— clean.prettier --checkon both changed files — clean.npm view react-native@0.85.3 peerDependenciesshows the old^19.2.3, and the 0.85.3 tarball'sReactNativeRenderer-dev.jscontains the exact19.2.3runtime check; semver simulation confirms19.2.6satisfies^19.2.3but not19.2.3.