【发布时间】:2020-02-26 07:47:46
【问题描述】:
我在几篇关于将图标应用到这个 react native 的文章中看到过,但是在我的路上我发现了一个错误。这样比较清楚
我做的步骤:
npm intall react-native-vector-icons --save
然后在 Example.js
import Icon from 'react-native-vector-icons/MaterialIcons';
export defaul class App extends React.Component {
render(){
return(
<Icon name='person-outline' type="MaterialIcons" />
)
}
}
我到这里后尝试了,但图标不起作用。 然后我看了几篇文章,需要执行以下命令。我愿意
react-native link react-native-vector-icons
我又试了一次。这有效。图标出现。 但在命令中我得到一个错误。 或多或少这样的错误
** error React Native CLI 对本地依赖项使用自动链接,但以下模块是手动链接的: - react-native-vector-icons(取消链接运行:“react-native unlink react-native-vector-icons”) **
我该怎么办??
【问题讨论】:
-
如果您使用的是 rn 0.60> 然后 react-native unlink react-native-vector-icons 首先尝试使用其他一些图标。如果它仍然不工作告诉
-
我使用 npm 0.60
react-native unlink react-native-vector-icons。但图标不再起作用。那么它如何工作@GauravRoy
标签: react-native