[英]react-native-vector-icons: Using FontAwesome
I am trying to use FontAwesome icons in my react-native app using this library react-native-vector-icons
. 我正在尝试使用此库
react-native-vector-icons
在我的react-native应用程序中使用FontAwesome react-native-vector-icons
。 I have followed the installation process (npm install, link, updating my gradle.properties...) Then in my code I import the Icon like this: 我遵循了安装过程(npm install,链接,更新gradle.properties ...),然后在我的代码中按如下所示导入Icon:
const Icon = require('react-native-vector-icons/FontAwesome');
And I use it in my render method: 我在渲染方法中使用它:
<Button>
<Icon name='home' />
</Button>
Unfortunately at runtime, this blows up with this error: 不幸的是,在运行时,会因以下错误而崩溃:
How can I use Fontawesome icons in my react-native app? 如何在我的本机应用程序中使用Fontawesome图标?
Thanks for your help 谢谢你的帮助
您必须改用import
:
import Icon from 'react-native-vector-icons/FontAwesome';
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.