我有一个使用react-navigation 3.3.0的堆栈导航器,并且我想为特定屏幕提供抽屉式导航

时间:2019-03-03 04:12:39

标签: react-native navigation-drawer react-navigation stack-navigator

我正在尝试使iOS移动应用程序具有本机响应。现在,我在App.js中有一个堆栈导航器

export const Navigation = createAppContainer(
  createStackNavigator({
    Screen1: { screen: Screen1 },
    Screen2: { screen: Screen2 },
    Screen3: { screen: Screen3 },
    Screen4: { screen: Screen4 },
  }),
)

我想在标题的左侧按钮(而不是后退按钮)上有一个屏幕4的抽屉导航器。我尝试按照示例进行操作,但是没有用。

1 个答案:

答案 0 :(得分:0)

像这样创建一个Drawer导航器,

const DrawerNavigator = createDrawerNavigator({
Screen4: { screen: Screen4 }
}

然后在您的堆栈导航器中使用此DrawerNavigator,

export const Navigation = createAppContainer(
  createStackNavigator({
    Screen1: { screen: Screen1 },
    Screen2: { screen: Screen2 },
    Screen3: { screen: Screen3 },
    drawer:DrawerNavigator ,
  }),
)