admin管理员组

文章数量:1391987

I am new in React Native. I want to set icon (from react-native-vector-icons) for ToolbarAndroid action. Here is my JSX code:

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.

Thanks for help.

I am new in React Native. I want to set icon (from react-native-vector-icons) for ToolbarAndroid action. Here is my JSX code:

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.

Thanks for help.

Share Improve this question edited Feb 24, 2016 at 1:55 matusalem asked Feb 24, 2016 at 1:50 matusalemmatusalem 2,5314 gold badges27 silver badges36 bronze badges
Add a ment  | 

1 Answer 1

Reset to default 8

By using React Native 0.21 and react-native-vector-icons 1.3.0 you can now use iconName like this:

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

本文标签: javascriptHow to set toolbar action icon in React NativeStack Overflow