为DrawerNavigator

时间:2017-10-19 10:01:08

标签: reactjs react-native

我想创建一个抽屉。对于通过抽屉访问的每个屏幕,我想显示我在WelcomeContainer AppNavigator上实际定制的相同标题。抽屉应与头部重叠。问题是标题只出现在主屏幕上:如果我点击类别菜单,抽屉就会消失。我甚至试图复制标题代码并在类别屏幕中将其过去,但没有出现任何内容。这是我的代码

const AppNavigator = StackNavigator({
  Home: {
    screen: WelcomeContainer,
    navigationOptions: ({navigation}) => ({
      headerLeft:
      <Icon name="menu" color='#5c72b0' size={35} style={{ flexDirection: 'row', justifyContent: 'space-between', alignItems:'center',
        paddingLeft:10 }} onPress={ () => navigation.navigate('DrawerOpen') } />,
      headerRight: 
      <Icon name="settings" color='#5c72b0' size={25} style={{ alignItems:'center', paddingRight:10 }} 
      onPress={ () => navigation.navigate('Settings', {title: I18n.t('settings.title') }) } />    })
  },
  Settings: {
  screen: SettingsContainer,
  navigationOptions: ({navigation}) => ({
    title: navigation.state.params.title
  })
},
  About: {
  screen: About,
  navigationOptions: ({navigation}) => ({
    title: navigation.state.params.title
  })
}
})



const AppDrawer = DrawerNavigator(
  {
    Home: {
      path: '/',
      screen: AppNavigator,
    },
    Category: {
      path: '/sent',
      screen: CategoryContainer,
    },
  },
  {
    initialRouteName: 'Home',
    contentOptions: {
      activeTintColor: '#e91e63',
    },
  }
);

你能帮我解决一下这个问题吗?

0 个答案:

没有答案