导航嵌套StackNavigator

时间:2018-05-24 16:25:14

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

如何导出嵌套(ish)StackNavigator和DrawerNavigator,并禁用后退键以便用户无法返回上一个屏幕?

以下是视图层次结构:



const login = StackNavigator(
  {
    loginScreen: { screen: Login },
    firstPage: { screen: CodeCollab },
  },
  {
    initialRouteName: "firstPage"
  }
)

const main = StackNavigator(
  {
    home: { screen: Home },
  }
)

const homeDrawer = DrawerNavigator(
  {
    first: { screen: main },
  },
  {
    contentComponent: DrawerContent
  }
)

const out = StackNavigator(
  {
    Login: login,
    Home: homeDrawer,
    split: Splitter
  },
  {
    headerMode: 'none',
    title: 'Main',
    initialRouteName: "split"
  }
)

export default out




我试图从login / loginScreen转到out / Home

1 个答案:

答案 0 :(得分:0)

尝试以下代码:

this.props.navigation.dispatch(NavigationActions.back());