首页 > 解决方案 > 反应原生:有办法显示 Ionicon 吗?

问题描述

我尝试显示图标,但它给了我一个错误:警告:道具类型失败:提供给name的价值道具无效ios-arrow-down-circleIcon

renderHeader = section => {
    let index = this.state.activeSections[0];
    let currentObj = this.state.section[index];
    console.log('state', section);
    return (
      <View style={styles.header}>
        <Text style={{fontWeight:'bold',fontSize: 20}}>{section.tableHeadAccordion}</Text>
        <Ionicon
            size={25}
            color={"black"}
            name={
              currentObj == section
                ? "ios-arrow-forward-circle" 
                : "ios-arrow-down-circle"
            }
          />
      </View>
    );
  };

标签: javascriptreactjsreact-nativeexpo

解决方案


包中的图标名称不同,尤其是在 react-native-vector-icons 中。

试试这些名字“ ios-arrow-dropdown”和“ ios-arrow-dropright”。


推荐阅读