在React native中,我只是应用react native库中的 Flatlist 。 成功安装了所有库
pakage.json
"dependencies": {
"feather-icons-react": "^0.3.0",
"react": "16.6.3",
"react-native": "0.57.8",
"react-native-elements": "^1.0.0-beta7",
"react-native-vector-icons": "^4.2.0"
},
"devDependencies": {
"babel-jest": "23.6.0",
"jest": "23.6.0",
"metro-react-native-babel-preset": "0.51.0",
"react-test-renderer": "16.6.3"
},
"jest": {
"preset": "react-native"
}
}
App.js
import React, {Component} from 'react';
import Main from './components/MainComponents';
const instructions = Platform.select({
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
android:
'Double tap R on your keyboard to reload,\n' +
'Shake or press menu button for dev menu',
});
type Props = {};
export default class App extends Component<Props> {
render() {
return (
<Main />
);
}
}
错误日志
error: bundling failed: Error: Unable to resolve module `react-native-vector-icons/Feather` from `F:\React Native\FirstProject\node_modules\react-native-elements\src\helpers\getIconType.js`: Module `react-native-vector-icons/Feather` does not exist in the Haste module map
新手对本机做出反应
我们将非常感谢您的帮助
谢谢
答案 0 :(得分:0)
要安装react-native-vector-icons,您需要先安装它,然后链接它。第一次运行:
npm install react-native-vector-icons --save
或者如果您使用纱线
yarn add react-native-vector-icons
然后,您必须像这样链接它:
react-native link react-native-vector-icons
答案 1 :(得分:0)
关闭正在运行的打包程序
运行react-native链接react-native-vector-icons
运行react-native start --reset-cache
最后使用react-native run-ios
答案 2 :(得分:0)
确保已使用yarn add react-native-vector-icons
安装了软件包,然后使用react-native start --reset-cache
重置了打包程序缓存
答案 3 :(得分:0)
此命令在我的情况下有效
react-native start --reset-cache