问题描述
我正在制作我的第一个React Native应用,我想在按钮中添加一些图标,例如I installed React Native Vector Icons,并在我的代码中使用它,例如:<IconButton icon='cart-plus' color='blue' />
。
问题是我可以在React Native Vector Icons目录中看到很多具有相同名称的图标:
解决方法
您将必须导入如下所示的正确图标组件
import FontAwesome from 'react-native-vector-icons/FontAwesome';
const myIcon = <FontAwesome name="cat-plus" size={30} color="#900" />;
import FontAwesome5 from 'react-native-vector-icons/FontAwesome5';
const myIcon = <FontAwesome5 name="cat-plus" size={30} color="#900" />;