如何在 React Native Vector Icon 中选择同名图标

How to choose icons with same name in React Native Vector Icon

我正在制作我的第一个 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" />;