upgrading-react-native
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUpgrading React Native
升级 React Native
Overview
概述
Covers the full React Native upgrade workflow: template diffs via Upgrade Helper, dependency updates, Expo SDK steps, and common pitfalls.
涵盖完整的 React Native 升级工作流程:通过 Upgrade Helper 的模板差异、依赖更新、Expo SDK 步骤以及常见陷阱。
Typical Upgrade Sequence
典型升级流程
- Route: Choose the right upgrade path via [upgrading-react-native.md][upgrading-react-native]
- Diff: Fetch the canonical template diff using Upgrade Helper via [upgrade-helper-core.md][upgrade-helper-core]
- Dependencies: Assess and update third-party packages via [upgrading-dependencies.md][upgrading-dependencies]
- React: Align React version if upgraded via [react.md][react]
- Expo (if applicable): Apply Expo SDK layer via [expo-sdk-upgrade.md][expo-sdk-upgrade]
- Verify: Run post-upgrade checks via [upgrade-verification.md][upgrade-verification]
bash
undefined- 路径:通过 [upgrading-react-native.md][upgrading-react-native] 选择正确的升级路径
- 差异:通过 [upgrade-helper-core.md][upgrade-helper-core] 使用 Upgrade Helper 获取规范模板差异
- 依赖:通过 [upgrading-dependencies.md][upgrading-dependencies] 评估和更新第三方包
- React:如果升级,通过 [react.md][react] 对齐 React 版本
- Expo(如适用):通过 [expo-sdk-upgrade.md][expo-sdk-upgrade] 应用 Expo SDK 层
- 验证:通过 [upgrade-verification.md][upgrade-verification] 运行升级后检查
bash
undefinedQuick start: detect current version and fetch diff
Quick start: detect current version and fetch diff
npm pkg get dependencies.react-native --prefix "$APP_DIR"
npm view react-native dist-tags.latest
npm pkg get dependencies.react-native --prefix "$APP_DIR"
npm view react-native dist-tags.latest
Example: upgrading from 0.76.9 to 0.78.2
Example: upgrading from 0.76.9 to 0.78.2
1. Fetch the template diff
1. Fetch the template diff
curl -L -f -o /tmp/rn-diff.diff
"https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs/0.76.9..0.78.2.diff"
&& echo "Diff downloaded OK" || echo "ERROR: diff not found, check versions"
"https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs/0.76.9..0.78.2.diff"
&& echo "Diff downloaded OK" || echo "ERROR: diff not found, check versions"
curl -L -f -o /tmp/rn-diff.diff
"https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs/0.76.9..0.78.2.diff"
&& echo "Diff downloaded OK" || echo "ERROR: diff not found, check versions"
"https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs/0.76.9..0.78.2.diff"
&& echo "Diff downloaded OK" || echo "ERROR: diff not found, check versions"
2. Review changed files
2. Review changed files
grep -n "^diff --git" /tmp/rn-diff.diff
grep -n "^diff --git" /tmp/rn-diff.diff
3. Update package.json, apply native changes, then install + rebuild
3. Update package.json, apply native changes, then install + rebuild
npm install --prefix "$APP_DIR"
cd "$APP_DIR/ios" && pod install
npm install --prefix "$APP_DIR"
cd "$APP_DIR/ios" && pod install
4. Validate: both platforms must build successfully
4. Validate: both platforms must build successfully
npx react-native build-android --mode debug --no-packager
xcodebuild -workspace "$APP_DIR/ios/App.xcworkspace" -scheme App -sdk iphonesimulator build
undefinednpx react-native build-android --mode debug --no-packager
xcodebuild -workspace "$APP_DIR/ios/App.xcworkspace" -scheme App -sdk iphonesimulator build
undefinedWhen to Apply
适用场景
Reference these guidelines when:
- Moving a React Native app to a newer version
- Reconciling native config changes from Upgrade Helper
- Validating release notes for breaking changes
在以下情况下参考这些指南:
- 将 React Native 应用升级到新版本
- 协调来自 Upgrade Helper 的原生配置更改
- 验证破坏性更改的发布说明
Quick Reference
快速参考
| File | Description |
|---|---|
| [upgrading-react-native.md][upgrading-react-native] | Router: choose the right upgrade path |
| [upgrade-helper-core.md][upgrade-helper-core] | Core Upgrade Helper workflow and reliability gates |
| [upgrading-dependencies.md][upgrading-dependencies] | Dependency compatibility checks and migration planning |
| [react.md][react] | React and React 19 upgrade alignment rules |
| [expo-sdk-upgrade.md][expo-sdk-upgrade] | Expo SDK-specific upgrade layer (conditional) |
| [upgrade-verification.md][upgrade-verification] | Post-upgrade verification checklist, including agent-device-assisted checks |
| [monorepo-singlerepo-targeting.md][monorepo-singlerepo-targeting] | Monorepo and single-repo app targeting and command scoping |
| 文件 | 说明 |
|---|---|
| [upgrading-react-native.md][upgrading-react-native] | 路由:选择正确的升级路径 |
| [upgrade-helper-core.md][upgrade-helper-core] | 核心 Upgrade Helper 工作流程与可靠性门槛 |
| [upgrading-dependencies.md][upgrading-dependencies] | 依赖兼容性检查和迁移规划 |
| [react.md][react] | React 与 React 19 升级对齐规则 |
| [expo-sdk-upgrade.md][expo-sdk-upgrade] | Expo SDK 专属升级层(条件性) |
| [upgrade-verification.md][upgrade-verification] | 升级后验证清单,包括 agent-device 辅助检查 |
| [monorepo-singlerepo-targeting.md][monorepo-singlerepo-targeting] | Monorepo 与单仓库应用定位及命令作用域 |
Problem → Skill Mapping
问题 → Skill 映射
| Problem | Start With |
|---|---|
| Need to upgrade React Native | upgrade-helper-core.md |
| Need dependency risk triage and migration options | upgrading-dependencies.md |
| Need React/React 19 package alignment | react.md |
| Need workflow routing first | upgrading-react-native.md |
| Need Expo SDK-specific steps | expo-sdk-upgrade.md |
| Need manual or agent-assisted regression validation | upgrade-verification.md |
| Need repo/app command scoping | monorepo-singlerepo-targeting.md |
| 问题 | 起始文件 |
|---|---|
| 需要升级 React Native | upgrade-helper-core.md |
| 需要依赖风险评估和迁移选项 | upgrading-dependencies.md |
| 需要 React/React 19 包对齐 | react.md |
| 需要优先进行工作流路由 | upgrading-react-native.md |
| 需要 Expo SDK 专属步骤 | expo-sdk-upgrade.md |
| 需要手动或 agent 辅助回归验证 | upgrade-verification.md |
| 需要仓库/应用命令作用域 | monorepo-singlerepo-targeting.md |