【问题标题】:How to choose icons with same name in React Native Vector Icon如何在 React Native Vector Icon 中选择同名图标
【发布时间】:2020-09-10 01:47:26
【问题描述】:

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

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

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

【问题讨论】:

    标签: react-native react-native-vector-icons


    【解决方案1】:

    您必须像下面这样导入正确的图标组件

    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" />;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-01-18
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多