【问题标题】:How to use nested navigation stacks in react native如何在本机反应中使用嵌套导航堆栈
【发布时间】:2021-01-23 19:07:01
【问题描述】:

下面是我的导航结构。

*抽屉导航器(

  • 仪表板 堆栈导航器({
    1. 登录
    2. 欢迎 })
  • 简介 堆栈导航器({
    1. 简介 }) )*

我在个人资料页面上有一个注销按钮,点击它我想将用户带回登录页面。

请帮忙。

下面是我的 Navigation.js 文件

const LoginNavigator = createStackNavigator({
    Login: LoginScreen,
    DashboardScreen: {
        screen: DashboardScreen,
    },
    CaptureWeightScreen: {
        screen: CaptureWeightScreen,
        navigationOptions: {
            headerBackTitle: " ",
            headerTintColor: "#000"
        }
    }
}, {
    navigationOptions: {
        drawerLabel: 'Dashboard'
    }
});
const ProfileNavigator = createStackNavigator({
    ProfileScreen: ProfileScreen
}, {
    navigationOptions: {
        drawerLabel: 'Profile'
    }
});
const MainNavigator = createDrawerNavigator({
    DashboardNavigator: LoginNavigator,
    ProfileNavigator: ProfileNavigator,
    
}, { 
    drawerBackgroundColor: Constants.buttonColor 
});
export default createAppContainer(MainNavigator)

【问题讨论】:

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


    【解决方案1】:

    this.props.navigation.navigate({ routeName: "Login", params: { } })

    就是答案。

    谢谢

    【讨论】:

      猜你喜欢
      • 2020-11-24
      • 2021-01-31
      • 2018-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-10-16
      • 2020-06-30
      相关资源
      最近更新 更多