[英]React native ToolbarAndroid action icon not working
I am using react native vector icons to display icons for the actions on the toolbar. 我正在使用react native矢量图标在工具栏上显示操作的图标。 But it doesn't seem to work. 但这似乎不起作用。
Imports & Icon 导入和图标
import Icon from 'react-native-vector-icons/FontAwesome';
const myIcon = (<Icon name="compass" size={30} color="#900" />)
Main view 主视图
<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'}
];
You can set the actions icon like this - 您可以这样设置操作图标-
var toolbarActions = [
{title:'Compass', iconName:'compass', iconColor:"#900", iconSize:30, show:'always'}
];
Furthermore you need to use Icon.ToolbarAndroid
instead of ToolbarAndroid
. 此外,你还需要使用Icon.ToolbarAndroid
而不是ToolbarAndroid
。
<Icon.ToolbarAndroid
actions={toolbarActions}
....
>
More details here - https://github.com/oblador/react-native-vector-icons#usage-with-toolbarandroid 更多详细信息-https: //github.com/oblador/react-native-vector-icons#usage-with-toolbarandroid
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.