[英]Dynamic navIconName ToolbarAndroid with react-native-vector-icon
I use react-native-vector-icon
and I would like props navIconName
change dynamically to have something like this: 我使用
react-native-vector-icon
,我希望道具navIconName
动态更改为具有以下内容:
import Icon, {ToolbarAndroid} from 'react-native-vector-icons/MaterialIcons';
...
render() {
const NAV_DRAWER_BUTTON = "menu";
const NAV_BACK_BUTTON = "bluetooth"
const ICON = this.props.navigationState.key == 'home'? NAV_DRAWER_BUTTON : NAV_BACK_BUTTON;
return (
<ToolbarAndroid
navIconName={ICON}
onIconClicked={this._onLogoSelected}
style={styles.toolbar}
subtitle={this.props.subtitle}
title={this.props.title} />
);
}
this works, but if, for example, I write const NAV_BACK_BUTTON = "arrow_back"
I have a message which said to use icon from given list in message. 这行得通,但是,例如,如果我写
const NAV_BACK_BUTTON = "arrow_back"
我有一条消息说使用消息中给定列表中的图标。 How to use my icon arrow_back? 如何使用我的图标arrow_back?
arrow_back
should be arrow-back
. arrow_back
应该是arrow-back
。
You can see list of all material icons here - https://materialicons.github.io/ 您可以在此处查看所有材料图标的列表-https: //materialicons.github.io/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.