首页 > 解决方案 > 新路线未显示在 React Native Drawer 中

问题描述

我对 React Native 非常陌生,试图在抽屉中添加一个测试屏幕,但我做不到。

import { createDrawerNavigator, createStackNavigator } from "react-navigation"
/* Some imports here neglected...*/

/*
* icon size
* */
const iconSize = 18

const IntegratedNavigation = createStackNavigator({
  bottomNavigator: { screen: BottomNavigator, navigationOptions: { header: null } },
  something: { screen: Something, navigationOptions: { header: null } },
  something2: { screen: SomethingElse, navigationOptions: { header: null } },
})

export const DrawerNavigator = createDrawerNavigator({
    Tabs: {
      screen: IntegratedNavigation,
      navigationOptions: {
        drawerLabel: "Explore",
        drawerIcon: ({ tintColor, focused }) => (
          <Icon icon={"search"} size={iconSize} color={tintColor}/>
        ),
        header: null,
      },
    },
    PartnersScreen: {
      screen: PartnersScreen,
      navigationOptions: {
        drawerLabel: "Partners",
        drawerIcon: ({ tintColor, focused }) => (
          <Icon icon={"safety"} size={iconSize} color={tintColor}/>
        ),
      },
    },
    HelloScreen: {
      screen: PartnersScreen, /*This is a testing new drawer tab that never appear!*/
      navigationOptions: {
        drawerLabel: "Test!",
        drawerIcon: ({ tintColor, focused }) => (
          <Icon icon={"test"} size={iconSize} color={tintColor}/>
        ),
      },
    },
  }, {
    contentOptions: {
      inactiveTintColor: color.palette.lightBlack,
      activeTintColor: color.primary,
    },
    contentComponent: props => (<MenuUserInfo drawerItemsProps={props}/>),
    drawerWidth: 240,
  },
)

作为测试,我只想将“PartnersScreen”复制为另一个选项卡。但新路线从未出现。我不知道我需要修改哪个其他文件。任何想法?

标签: reactjsreact-native

解决方案


推荐阅读