1

我的应用程序上有抽屉导航和堆栈导航。

export const AppDrawerNavigator = createDrawerNavigator(
{
    Home: {
      screen: Home,
      navigationOptions: {
        drawerIcon: ({ tintColor }) => (
          <Icon name="home" style={{ fontSize: 24, color: tintColor }} />
        )
      }
    },
    MyAccount: {
      screen: MyAccount,
      navigationOptions: {
        drawerIcon: ({ tintColor }) => (
          <Icon name="paper" style={{ fontSize: 24, color: tintColor }} />
        )
      }
    },
    Cashback: {
      screen: Cashback,
      navigationOptions: {
        drawerIcon: ({ tintColor }) => (
          <Icon name="pizza" style={{ fontSize: 24, color: tintColor }} />
        )
      }
    },
    Settings: {
      screen: Settings,
      navigationOptions: {
        drawerIcon: ({ tintColor }) => (
          <Icon name="settings" style={{ fontSize: 24, color: tintColor }} />
        )
      }
    },
    Campaigns: {
      screen: Campaigns,
      navigationOptions: {
        drawerIcon: ({ tintColor }) => (
          <Icon name="call" style={{ fontSize: 24, color: tintColor }} />
        )
      }
    }
  },
  {
    contentComponent: CustomDrawerComponent,
    contentOptions: { activeTintColor: "#60c2a2" }
  }
);

export const AppStackNavigator = createStackNavigator(
  {
    OnBoarding: {
      screen: OnBoardingContent
    },
    Login: {
      screen: Login
    },
    MarchantLogin: {
      screen: MarchantLogin
    },
    OTPScreen: {
      screen: OTPScreen
    },
    Home: {
      screen: Home
    },
    Drawer: {
      screen: AppDrawerNavigator
    }
  },
  {
    headerMode: "none",
    initialRouteName: "Drawer",
    navigationOptions: {
      headerVisible: false
    }
  }
);

然后我打电话给

render() {
    if (this.state.is_verified == "true") {
      return <AppStackNavigator />;
    } else {
      return <OnBoarding />;
    }
  }

我的问题是,当我单击抽屉按钮内的注销时,我需要路由到 OnBoarding 组件。但怎么可能呢? 在此处输入图像描述

请帮我解决这个问题或建议我一个更好的主意,因为我是这个堆栈的新手。谢谢你。

4

0 回答 0