user-interface - 如何在 React-Native-Elements 中使用 Ant Design Icon

标签 user-interface react-native antd

React Native Elements ,有一个链接到 icon directory .第一个库是 AntDesign:Screenshot

在类型中,他们说“类型(默认为 Material ,选项为 Material 社区、zocial、 Font Awesome 、octicon、ionicon、foundation、evilicon、simple-line-icon、feather 或 entypo)”。 AntD 不包括在这些中。我试过 type="ant-d" , type="antd" , type="ant-design"type="antdesign" .我想尽可能少地浪费时间,因为这似乎非常简单。我错过了什么?

这是我的代码片段,我在其中添加了 type :

render() {
  const { selectedIndex } = this.state
  const buttons = [
    { element: () => <Icon name="notification" type="ant-design" color={ selectedIndex === 0 ? colorsAndFonts.colors.redBalehu : colorsAndFonts.colors.warmGrey } /> },
    { element: () => <Icon name="credit-card" color={ selectedIndex === 1 ? colorsAndFonts.colors.redBalehu : colorsAndFonts.colors.warmGrey } /> },
    { element: () => <Icon name="account-circle" color={ selectedIndex === 2 ? colorsAndFonts.colors.redBalehu : colorsAndFonts.colors.warmGrey } /> },
    { element: () => <Icon name="camera-alt" onPress={ this.takePhoto } color={ selectedIndex === 3 ? colorsAndFonts.colors.redBalehu : colorsAndFonts.colors.warmGrey } /> },
    { element: () => <Icon name="help-outline" color={ selectedIndex === 4 ? colorsAndFonts.colors.redBalehu : colorsAndFonts.colors.warmGrey } /> },
]

当然,我只是得到一个 ?返回而不是图标。

提前致谢!

最佳答案

你可以这样使用:

    import AntIcon from "react-native-vector-icons/AntDesign";

...

    <AntIcon name="minuscircleo" color="green" size={50} />

顺便说一句,这对所有图书馆都有效

关于user-interface - 如何在 React-Native-Elements 中使用 Ant Design Icon,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52840741/

相关文章:

Java JApplet : Why aren't my components appearing on screen?

javascript - 日志记录对 native 事件使用react,console.log 未触发并最终使应用程序崩溃

flexbox - React Native 样式表 : what does {flex:1} do?

javascript - 如何在外部npm包中使用React的Link组件而不出现错误: invariant "you should not use link outside router"

javascript - React KeyboardEvent 在 onPressEnter 后更改输入值

reactjs - 将正确的属性传递给弹出通知

java - Netbeans JPopupMenu 问题

user-interface - 在 pygame 中添加 wxpython

ruby - Linux 上 Ruby 中的 native 系统调用

javascript - Ant Design Mobile Picker 在 React Native 中使用时不会从底部弹出