1

我正在制作我的第一个 React Native 应用程序,我想在我的按钮中添加一些图标,所以我安装了 React Native Vector Icons,并在我的代码中使用它,如下所示:<IconButton icon='cart-plus' color='blue' />.

问题是我可以在 React Native Vector Icons 目录中看到有很多同名的图标:

在此处输入图像描述

我找不到一种方法来指定我要显示的那个。

4

1 回答 1

0

您将必须导入正确的图标组件,如下所示

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" />;
于 2020-09-10T03:18:50.687 回答