在 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/