用途:用于把 FlashList 仓库中的 React Native fixture 应用(位于 fixture/react-native/)升级到新的 React Native 版本,该应用是 FlashList 在 iOS 和 Android 上的主要测试载体。
主要步骤:先用 npm view react-native@latest version 查最新稳定版,并参考 rn-diff-purge 仓库对比模板差异(package.json、android/build.gradle、app/build.gradle、gradle.properties、gradle-wrapper.properties、settings.gradle、MainApplication.kt、ios/Podfile、AppDelegate.swift、metro.config.js)。随后按顺序更新依赖:react/react-native、@react-native/* 开发包、CLI 包、第三方原生库及新增 peer 依赖;检查 Babel 插件是否迁移;Metro 内部模块路径变化需验证导入。
Android 侧需同步 buildToolsVersion、compileSdkVersion、targetSdkVersion、kotlinVersion、ndkVersion,更新 Gradle 发行版 URL,移除废弃标志(如 android.enableJetifier、FLIPPER_VERSION),并对照模板更新 MainApplication.kt(如 0.79 的 SoLoader.init()+DefaultNewArchitectureEntryPoint.load() 对比 0.84 的 loadReactNative(this)+getDefaultReactHost())。iOS 侧需匹配 Podfile 结构、删除废弃环境变量与辅助调用,更新 pbxproj 中的 IPHONEOS_DEPLOYMENT_TARGET,并在 Info.plist 添加新键。之后执行清理安装(rm -rf node_modules yarn.lock 等)、构建验证(yarn build、xcodebuild、run-android、expo export)与测试(yarn test、E2E),截图对比参考需删除旧参考目录后重跑生成。
限制与注意:Metro exclusionList 导入路径易变;测试前需杀掉所有 Metro 实例;reanimated 主版本升级可能需改 Babel 插件并新增 react-native-worklets;Gradle 大版本跳跃可能破坏脚本;RN 0.82+ 逐步移除旧架构,需确认依赖支持新架构。