react-native - 图标颜色在本机基本标题按钮中不起作用
问题描述
我正在使用NativeBase Header。在标题中,我有购物车和愿望清单等按钮。但我无法更改该图标的颜色。
这是我的标题代码:
<Header>
<Left>
<Button transparent onPress={props.onMenuPress}>
<Icon type="Ionicons" name="menu" color="#ff0000" />
</Button>
</Left>
<Body>
<Title>{props.title}</Title>
</Body>
<Right>
<Button transparent onPress={props.onWishlistPress}>
<Icon name="heart" active={false} color="#ff0000" />
</Button>
<Button transparent onPress={props.onCartPress} icon>
<Icon name="cart" active={false} color="#ff0000" />
</Button>
</Right>
</Header>
请任何人都可以告诉我这里有什么问题吗?
解决方案
它显示在Native-base
文档中。对于 Icon,Native-base
使用React-native-vector-icons
模块,它允许您设置colors
和sizes
通过style
.
图标
完美、清晰、高清的图标和像素理想的字体,NativeBase
以保持非常高的质量。您将在您的计划中不断拥有像素完美的图标。这是一个列出可用react-native-vector-icons
图标系列图标的存储库。回购
使用来自 React Native Vector Icons 的 Ionicons
示例
<Icon name='home' />
<Icon ios='ios-menu' android="md-menu" style={{fontSize: 20, color: 'red'}}/>
<Icon type="FontAwesome" name="home" />
推荐阅读
- html - html输入字段开始水平自动滚动时如何更改?
- mysql - Eloquent:根据工作日获取值的总和(json 属性)
- javascript - 用 javascript 中的函数开玩笑创建一个测试来检查 csv.href
- javascript - 使用 JFROG AQL 命令将 curl Artifactory 转换为 javascript 获取请求:401 未经授权的错误
- data-science - NVIDIA data-science-stack ==> 要使更改生效,请关闭并重新打开您当前的 shell。<==
- python - 重新安装windows后程序不再工作
- amazon-dynamodb - DynamoDB 扫描忽略大写或小写字母
- oauth-2.0 - OAuth2 服务注册表缓存未在 CAS 6.3.x 中补水
- python - 读取 CSV 时使用多个引号字符
- javascript - 如何替换字符串中的肤色变体表情符号?