upgrade-react-native by react-native-community/skills
npx skills add https://github.com/react-native-community/skills --skill upgrade-react-native通过获取并应用来自 React Native Upgrade Helper 的差异,将 React Native Community CLI 项目升级到目标版本。
[!Note] Expo 用户: 对于 Expo 项目或更复杂的升级场景,请尝试:
/upgrade-react-native <targetVersion>
<targetVersion> — 要升级到的 React Native 版本(例如 0.79.0)。按顺序 遵循以下每个步骤。不要跳过步骤。
读取项目根目录的 package.json,并从 (或 )中提取 版本。去除任何 semver 范围前缀(、、 等)以获取确切的当前版本字符串。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
dependenciesdevDependenciesreact-native^~>=如果无法确定当前版本,请停止并询问用户。
目标版本必须是有效的 semver 字符串(例如 0.79.0)。
它必须大于当前版本。
通过检查以下内容来验证目标版本是否存在:
https://raw.githubusercontent.com/react-native-community/rn-diff-purge/master/RELEASES
获取此文件并确认目标版本已列出。如果没有,请报告最接近的可用版本并让用户选择。
获取两个版本之间的统一差异:
https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs/<currentVersion>..<targetVersion>.diff
例如,要从 0.73.0 升级到 0.74.0:
https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs/0.73.0..0.74.0.diff
如果无法获取差异(404),可能是因为确切的补丁版本不可用。尝试最接近的次要版本(例如,使用 0.73.0 而不是 0.73.2)。报告你尝试的内容,并在需要时询问用户。
差异使用模板项目名称 RnDiffApp。将差异中的每个路径映射到实际项目:
| 差异路径前缀 | 实际项目路径 |
|---|---|
RnDiffApp/ | 项目根目录 (./) |
此外,将模板标识符的出现替换为项目的实际名称:
| 模板值 | 替换为 |
|---|---|
RnDiffApp | 项目的应用名称(来自 app.json → name,或 package.json 中的 name 字段) |
rndiffapp | 项目应用名称的小写版本 |
com.rndiffapp | 项目的 Android 包名(来自 android/app/build.gradle 或 android/app/src/main/AndroidManifest.xml) |
在进行任何编辑之前,请审查整个差异并对更改进行分类:
- 行匹配的文件。这些可以按原样应用。在继续之前,将此计划呈现给用户。按区域对更改进行分组:
package.json、metro.config.js、.eslintrc.js 等)ios/ 目录)android/ 目录)按照步骤 5 的计划应用更改:
+ 行。重要注意事项:
package.json 时,更新 react-native 版本以及差异中提到的任何相关依赖项(例如 react、@react-native/* 包、Gradle 版本、CocoaPods 版本)。npm install / yarn install / pod install。告知用户升级后需要这些步骤。扫描项目 package.json 中的 dependencies 和 devDependencies,查找包含原生代码的第三方 React Native 库(即它们有 ios/ 或 android/ 目录,或者是已知的原生模块)。常见示例包括 react-native-screens、react-native-reanimated、react-native-gesture-handler、@react-native-async-storage/async-storage、react-native-svg、react-native-safe-area-context 等。
对于每个候选依赖项:
将所有提议的依赖项更新与步骤 5 中基于差异的更改一起呈现(分组在第三方原生依赖项部分下)。对于每个依赖项:
在步骤 6 中,将这些版本更新应用到 package.json。
应用所有更改后,向用户呈现一个检查清单:
npm install 或 yarn install 以更新 JS 依赖项cd ios && bundle exec pod install(或 npx pod-install)以更新 iOS 原生依赖项cd android && ./gradlew cleancd ios && xcodebuild clean查阅以下内容以获取特定版本的迁移指南:
每周安装次数
329
代码仓库
GitHub 星标数
14
首次出现
2026年2月11日
安全审计
安装于
github-copilot320
opencode319
codex319
gemini-cli316
amp313
kimi-cli313
Upgrade a React Native Community CLI project to a target version by fetching and applying the diff from the React Native Upgrade Helper.
[!Note] Expo users: For Expo projects or more complex upgrade scenarios, try:
/upgrade-react-native <targetVersion>
<targetVersion> — the React Native version to upgrade to (e.g. 0.79.0).Follow every step below in order. Do not skip steps.
Read the project's root package.json and extract the react-native version from dependencies (or devDependencies). Strip any semver range prefix (^, ~, >=, etc.) to get the exact current version string.
If the current version cannot be determined, stop and ask the user.
The target version must be a valid semver string (e.g. 0.79.0).
It must be greater than the current version.
Verify the target version exists by checking:
https://raw.githubusercontent.com/react-native-community/rn-diff-purge/master/RELEASES
Fetch this file and confirm the target version is listed. If not, report the closest available versions and ask the user to choose.
Fetch the unified diff between the two versions:
https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs/<currentVersion>..<targetVersion>.diff
For example, to upgrade from 0.73.0 to 0.74.0:
https://raw.githubusercontent.com/react-native-community/rn-diff-purge/diffs/diffs/0.73.0..0.74.0.diff
If the diff cannot be fetched (404), it may be because exact patch versions are not available. Try the nearest minor versions (e.g. 0.73.0 instead of 0.73.2). Report what you tried and ask the user if needed.
The diff uses the template project name RnDiffApp. Map every path in the diff to the actual project:
| Diff path prefix | Actual project path |
|---|---|
RnDiffApp/ | Project root (./) |
Additionally, replace occurrences of the template identifiers with the project's actual names:
| Template value | Replace with |
|---|---|
RnDiffApp | The project's app name (from app.json → name, or the name field in package.json) |
rndiffapp | Lowercase version of the project's app name |
com.rndiffapp | The project's Android package name (from android/app/build.gradle or ) |
Before making any edits, review the entire diff and categorize changes:
- lines. These can be applied as-is.Present this plan to the user before proceeding. Group changes by area:
package.json, metro.config.js, .eslintrc.js, etc.)ios/ directory)android/ directory)Apply the changes following the plan from step 5:
+ lines.Important considerations:
package.json, update the react-native version and any related dependencies mentioned in the diff (e.g. react, @react-native/* packages, Gradle versions, CocoaPods versions).npm install / yarn install / pod install automatically. Inform the user these steps are needed after the upgrade.Scan the project's dependencies and devDependencies in package.json for third-party React Native libraries that contain native code (i.e. they have an ios/ or android/ directory, or are known native modules). Common examples include react-native-screens, react-native-reanimated, react-native-gesture-handler, @react-native-async-storage/async-storage, react-native-svg, react-native-safe-area-context, etc.
For each candidate dependency:
Present all proposed dependency bumps alongside the diff-based changes in step 5 (grouped under a Third-party native dependencies section). For each:
Apply these version bumps to package.json as part of step 6.
After applying all changes, present the user with a checklist:
npm install or yarn install to update JS dependenciescd ios && bundle exec pod install (or npx pod-install) to update native iOS dependenciescd android && ./gradlew cleancd ios && xcodebuild cleanConsult these for version-specific migration guidance:
Weekly Installs
329
Repository
GitHub Stars
14
First Seen
Feb 11, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
github-copilot320
opencode319
codex319
gemini-cli316
amp313
kimi-cli313
agent-browser 浏览器自动化工具 - Vercel Labs 命令行网页操作与测试
138,300 周安装
WPS Office跨应用智能助手:Excel、Word、PPT批量处理与数据迁移操作指南
560 周安装
Docker专家:容器优化、安全加固、多阶段构建与生产部署最佳实践
471 周安装
Skill Creator 技能创建指南:为 Claude AI 构建模块化专业技能的完整教程
539 周安装
下游影响分析技能:追踪数据血缘关系,评估变更风险,防止破坏生产环境
462 周安装
GitHub Copilot for Azure 集成测试失败自动创建 Issue 工具 | 测试自动化
579 周安装
Rust云原生开发指南:领域约束、设计模式与关键Crate实践
454 周安装
android/app/src/main/AndroidManifest.xml