无法从“screens\SignUpScreen.js”解析“react-native-paper/lib/typescript/src/components/MaterialCommunityIco
Posted
技术标签:
【中文标题】无法从“screens\\SignUpScreen.js”解析“react-native-paper/lib/typescript/src/components/MaterialCommunityIcon”【英文标题】:Unable to resolve "react-native-paper/lib/typescript/src/components/MaterialCommunityIcon" from "screens\SignUpScreen.js"无法从“screens\SignUpScreen.js”解析“react-native-paper/lib/typescript/src/components/MaterialCommunityIcon” 【发布时间】:2020-05-17 01:28:31 【问题描述】:我运行 npm start
或 expo start -c
以从空缓存开始,到目前为止一切顺利,但是当我尝试运行 android 模拟器时,出现以下错误
无法从“screens\SignUpScreen.js”解析“react-native-paper/lib/typescript/src/components/MaterialCommunityIcon” 构建 JavaScript 包失败。
我已经尝试过删除 node_modules,更新 Expo SDK,其他几个人也尝试过,但目前没有...
这是我的 package.json
"main": "node_modules/expo/AppEntry.js",
"scripts":
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
,
"dependencies":
"@react-native-community/masked-view": "0.1.6",
"@react-navigation/material-bottom-tabs": "^5.2.2",
"expo": "^37.0.0",
"react": "16.9.0",
"react-dom": "16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz",
"react-native-elements": "^2.0.0",
"react-native-gesture-handler": "~1.6.0",
"react-native-paper": "^3.10.1",
"react-native-reanimated": "~1.7.0",
"react-native-safe-area-context": "0.7.3",
"react-native-screens": "~2.2.0",
"react-native-vector-icons": "^6.6.0",
"react-native-web": "^0.11.7",
"react-navigation": "^4.3.9",
"react-navigation-stack": "^2.5.1"
,
"devDependencies":
"babel-preset-expo": "^8.1.0",
"@babel/core": "^7.8.6"
,
"private": true
有什么想法吗?
【问题讨论】:
【参考方案1】:我再次查看了我在 SignUpScreen.js
上的导入,发现了这个导入:
import accessibilityProps from 'react-native-paper/lib/typescript/src/components/MaterialCommunityIcon';
导致问题的原因,将其删除,现在一切正常。
【讨论】:
【参考方案2】:也为我工作!
删除:
import black from "react-native-paper/lib/typescript/src/styles/colors";
然后重新加载你的 biuld。
【讨论】:
以上是关于无法从“screens\SignUpScreen.js”解析“react-native-paper/lib/typescript/src/components/MaterialCommunityIco的主要内容,如果未能解决你的问题,请参考以下文章
DateTimeParseException:无法解析文本:无法从 TemporalAccessor 获取 LocalDateTime