这是我的package.json:
{
"name": "BStore",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"expo": "^32.0.5",
"native-base": "^2.11.0",
"prop-types": "^15.7.2",
"react": "16.6.3",
"react-native": "0.58.3",
"react-native-gesture-handler": "^1.0.15",
"react-native-paper": "^2.11.0",
"react-navigation": "^3.0.9",
"react-navigation-material-bottom-tabs": "^1.0.0"
},
"devDependencies": {
"babel-core": "7.0.0-bridge.0",
"babel-jest": "24.1.0",
"jest": "24.1.0",
"metro-react-native-babel-preset": "0.51.1",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
}
}
我收到此错误Unable to resolve module
react-native / Libraries / Components / View / ViewStylePropTypes`
有什么想法可以解决这个问题吗?
答案 0 :(得分:10)
有同样的问题。
正如我发现32.0.5博览会和本机0.58.3不兼容。因此应使用expo react-native fork。
要安装它,可以使用命令
npm install --save react-native@https://github.com/expo/react-native/archive/sdk-32.0.1.tar.gz
答案 1 :(得分:1)
您必须仔细阅读错误消息。我有同样的问题,我的是:
无法解析模块
react-native/Libraries/Components/View/ViewStylePropTypes
来自/APP/node_modules/react-native-render-html/src/HTMLUtils.js
: 模块react-native/Libraries/Components/View/ViewStylePropTypes
快捷模块映射中不存在
因此,第三方库react-native-render-html
会导致错误,因为它尝试使用ViewStylePropTypes。
如果是 @ adrian-moisa :对您来说是react-native-reanimated
。
不知道ThreadOpener的原因是什么,他没有发布可用的错误消息。
事实是,ViewStylePropTypes
已从react-native 0.58
中删除
比较: https://github.com/facebook/react-native/tree/v0.57.8/Libraries/Components/View https://github.com/facebook/react-native/tree/v0.58.0/Libraries/Components/View
所以解决方案是找出导致该错误的3rd-Party Component,并查看维护者是否进行了升级,或者您自己必须对其进行修补(例如,使用patch-package)
答案 2 :(得分:0)
此组合对我有用:
"expo": "^31.0.4",
"react": "16.5.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-31.0.1.tar.gz",
答案 3 :(得分:0)
我调整了here中的说明,并选择了适合我的方法:
以下是将应用程序从31.0.0升级到Expo SDK 32.0.6的方法: