添加按钮到StackNavigator标头

时间:2017-10-18 12:08:40

标签: reactjs react-native react-navigation

如何在标题中添加第三个按钮?我想创建像这样的东西

enter image description here

我使用以下代码添加了左侧和右侧组件:

const AppNavigator = StackNavigator({
  Home: {
    screen: AppDrawer,
    navigationOptions: ({navigation}) => ({
      headerLeft: <Icon name="menu" size={35}
                         onPress={ () => navigation.navigate('DrawerOpen') } />,
      headerRight: <HeaderUserInformation />,

    })
  },

如何在显示的位置添加eath组件?我试过了,但是我收到了一个错误

headerRight: 
      <View style={{ flexDirection: 'row', justifyContent: 'center' }}>
      <HeaderUserInformation />
      <earthComponent />
      </View>

0 个答案:

没有答案