如何在标签导航中导航到单个屏幕。反应导航

时间:2018-08-21 11:25:23

标签: javascript react-native react-navigation

是这种情况。我假设登录屏幕是基于选项卡的,一个选项卡是登录,另一个选项卡是注册。我也有“忘记密码”按钮。因此,当我按“忘记密码”按钮时,我想转到一个不包含选项卡导航并且在标题中具有“后退”按钮的屏幕。

如果这有任何帮助,这是我的导航器:

const LoginStack = createStackNavigator({
  Login: LoginScreen,
});

LoginStack.navigationOptions = {
  tabBarLabel: 'Login',
  tabBarIcon: ({ focused }) => (
    <TabBarIcon
      focused={focused}
      name={"login"}
    />
  ),
  tabBarOptions: {
    activeTintColor: "black",
  }
};

const RegisterStack = createStackNavigator({
  Register: RegisterScreen,
});

RegisterStack.navigationOptions = {
  tabBarLabel: 'Register',
  tabBarIcon: ({ focused }) => (
    <TabBarIcon
      focused={focused}
      name={"account-plus"}
    />
  ),
  tabBarOptions: {
    activeTintColor: "black",
  }
};


export default createBottomTabNavigator({
  LoginStack,
  RegisterStack,
});

如果您需要更多信息,请发表评论。

谢谢!

1 个答案:

答案 0 :(得分:0)

您可以直接创建选项卡,而不是直接导出createBottomTabNavigator,如下所示

const Tabs = createBottomTabNavigator({
  LoginStack,
  RegisterStack,
});
const AppNavigator = createStackNavigator({
Tabs,
ForgotPassword: {
screen: ForgotPassword,
}
}) //fixed brackets
export AppNavigator