![](/img/trans.png)
[英]Icon.button are working but Icon.ToolbarAndroid are not working in react native
[英]React native ToolbarAndroid action icon not working
我正在使用react native矢量图标在工具栏上显示操作的图标。 但这似乎不起作用。
导入和图标
import Icon from 'react-native-vector-icons/FontAwesome';
const myIcon = (<Icon name="compass" size={30} color="#900" />)
主视图
<View style={styles.containerToolbar}>
<ToolbarAndroid style={styles.toolbar}
title="Test"
actions={toolbarActions}
onActionSelected={this.onActionSelected}>
</ToolbarAndroid>
</View>
var toolbarActions = [
{title: 'Compass', icon:{myIcon} show: 'always'}
];
您可以这样设置操作图标-
var toolbarActions = [
{title:'Compass', iconName:'compass', iconColor:"#900", iconSize:30, show:'always'}
];
此外,你还需要使用Icon.ToolbarAndroid
而不是ToolbarAndroid
。
<Icon.ToolbarAndroid
actions={toolbarActions}
....
>
更多详细信息-https: //github.com/oblador/react-native-vector-icons#usage-with-toolbarandroid
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.