依赖项更新
步骤1: 依赖项更新
1.1 更新核心依赖项
使用RN 0.83中的新版本替换package.json依赖项的相关部分。
{
"dependencies": {
"react": "19.2.0",
"react-native": "0.83.0",
"@amazon-devices/react-native-kepler": "4.0.0",
"@react-native/new-app-screen": "0.83.0",
"react-native-safe-area-context": "^5.5.2"
},
"devDependencies": {
"@babel/core": "^7.25.2",
"@babel/preset-env": "^7.25.3",
"@babel/runtime": "^7.25.0",
"@react-native/babel-preset": "0.83.0",
"@react-native/eslint-config": "0.83.0",
"@react-native/metro-config": "0.83.0",
"@react-native/typescript-config": "0.83.0",
"@react-native-community/cli": "11.3.2",
"@types/react": "^19.2.0",
"@types/react-test-renderer": "^19.1.0",
"@types/jest": "^29.5.0",
"babel-jest": "^29.6.3",
"eslint": "^8.57.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "19.2.0",
"ts-jest": "^29.1.0",
"typescript": "5.8.3",
"@amazon-devices/keplerscript-commonmodules": "^1.0.0"
},
"engines": {
"node": ">=22.14.0"
}
}
RN83的必要依赖项
RN83需要以下依赖项:
-
@react-native-community/cli:@amazon-devices/kepler-cli-platform需要版本11.3.2来注册vega build命令。移除该项会导致npm run build:release失败,并报错"Unrecognized command vega build"。 -
jest依赖项:jest、babel-jest、ts-jest和@types/jest均须为v29。混合使用v28和v29会导致ERESOLVE无法解析依赖关系树。 -
react覆盖: 如果您有含"react"的overrides部分,则将其更新到"19.2.0":"overrides": { "react": "19.2.0" }
1.2 更新第三方程序包
更新所有第三方程序包至其RN 0.83兼容版本。有关完整的版本表,请参阅支持的库和服务。
常用包示例
{
"@amazon-devices/react-native-reanimated": "~4.0.0",
"@amazon-devices/react-native-worklets": "~1.0.0",
"@amazon-devices/react-native-gesture-handler": "~4.0.0",
"@amazon-devices/react-native-screens": "~3.0.0",
"@amazon-devices/react-native-svg": "~3.0.0",
"@amazon-devices/react-native-fast-image": "~3.0.0",
"@amazon-devices/kepler-ui-components": "^3.0.0",
"@amazon-devices/react-native-localize": "~2.1.0",
"@amazon-devices/react-native-async-storage__async-storage": "~2.1.0"
}
1.3 其他库更新
部分库对React Native 0.83提出了新要求:
-
react-native-reanimated需要react-native-worklets。如果您的应用使用@amazon-devices/react-native-reanimated,必须另外添加@amazon-devices/react-native-worklets作为依赖项。这是reanimated 4.0.0中新增的必需运行时依赖项。缺失该项会导致应用在启动时崩溃,且无明确的错误信息。 -
@amazon-devices/shopify__flash-list与RN 0.83不兼容。直接改用上游的@shopify/flash-list@2.1.0程序包。包装版本在RN 0.83的捆绑包分包系统中存在模块解析错误。 -
kepler-ui-components必须为3.0.0+。2.x版本捆绑了自身的react-native副本,且带有传递依赖,导致Jest测试因Flow/ESM解析错误而失败。所有使用kepler-ui-components的应用均受此影响,不仅限于轮播用户。
1.4 安装依赖项
运行npm install以接收其他所有依赖项。
# 全新安装,以免发生过时的缓存冲突
rm -rf node_modules package-lock.json
npm install
Last updated: 2026年7月9日

