我想使用带有react原生应用程序的react-native-element。首先,我成功地安装了react-elements。现在,我尝试使用类型为font-awesome的Icon。但图标显示不正确。为了让图标正常工作,我还需要单独安装font- need吗?还是我错过了什么。这是我的代码,
<Icon
raised
name='heartbeat'
type='font-awesome'
color='#f50'
onPress={() => console.log('hello')} />谢谢!
发布于 2019-09-08 18:53:22
如果您没有使用Expo或create-react-native- react-native-vector-icons,react-native-elements需要手动安装应用程序。See the documentation (React Native CLI) for more info.
在安装了这两个包之后,您需要链接react-native-vector-icons (正如您在README of the GitHub repo中看到的)。最简单的方法是这样做:
react-native link react-native-vector-icons之后,一切都会正常工作。如果您已经完成了所有这些操作,但仍然不起作用,请删除node_modules文件夹并使用npm i重新安装您的节点包。如果它仍然不起作用,请尝试手动链接包(您可以在上面链接的GitHub代码库上找到如何执行此操作的指南)。
https://stackoverflow.com/questions/57840656
复制相似问题