简体   繁体   English

如何在React Native中设置工具栏操作图标?

[英]How to set toolbar action icon in React Native?

I am new in React Native. 我是React Native的新手。 I want to set icon (from react-native-vector-icons ) for ToolbarAndroid action. 我想为ToolbarAndroid动作设置图标(来自react-native-vector-icons )。 Here is my JSX code: 这是我的JSX代码:

import ToolbarAndroid from 'ToolbarAndroid';
import MaterialIcon from 'react-native-vector-icons/MaterialIcons';
...
<ToolbarAndroid
  title='SomeTitle'
  titleColor='white'
  style={styles.toolbar}
  actions={[
    { title: 'Done', icon: 'HERE_I_DONT_KNOW_WHAT_TO_PUT', show: 'always' },
    { title: 'Setting', show: 'always' },
   ]}
/>
...

Name of icon from material design collection is done . done材料设计集合中的图标名称。

Thanks for help. 感谢帮助。

By using React Native 0.21 and react-native-vector-icons 1.3.0 you can now use iconName like this: 通过使用React Native 0.21和react-native-vector-icons 1.3.0,您现在可以像这样使用iconName

<MaterialIcon.ToolbarAndroid
  title='SomeTitle'
  titleColor='white'
  style={styles.toolbar}
  actions={[
    { title: 'Done', iconName: 'done', show: 'always' },
    { title: 'Setting', show: 'always' },
   ]}
/>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在React Native中的工具栏图标中显示通知数 - How to display count of notifications in toolbar icon in react native 如何添加购物车图标反应原生操作栏? - How to add cart icon react native action bar? 如果使用fontawesome图标集,如何将操作按钮添加到免费的jqgrid工具栏 - How add action button to free jqgrid toolbar if fontawesome icon set is used REACT NATIVE REDUX如何在动作创建者收到的化简器中设置数组 - REACT NATIVE REDUX How to set an array in the reducer received by the action creator 如何让本地人做出反应 <Text> 识别设置为字符串类型的图标字符 - How to let react native <Text> recognize Icon characters which are set as String type 如何将 activeID 的状态设置为 React Native 中 MapBox 上选定图标的特定 feature.id - How do I set state of activeID to be the specific feature.id of a selected icon on MapBox in React Native 如何在 react-native 中的按钮上添加图标 - How to add an icon to a button in react-native 如何以图标 React Native 的形式返回函数 - How to return a function as an Icon React Native React Native 如何通过图标打开抽屉 - React Native How to open Drawer by icon 如何在 TabNavigator 上显示图标以响应本机 - How to Show Icon on TabNavigator in react native
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM