首页 > 解决方案 > react native:navigation 5 - 如何从 Tab.Navigator 返回?

问题描述

导航 5 - 如何从 Tab.Navigator 返回?问题是,如果我现在在一个特定的 Tab.Navigator 中然后尝试返回,那么它会继续在 Tab.Navigator 中从右到左导航我,然后返回并退出 Tab.Navigator。我不明白如何防止这种情况。我只是希望当我在某个 Tab.Navigator 中并想从中返回时,他不会在同一个 Tab.Navigator 中导航我,而是会按照我的意愿返回。

这是我的标签示例:

export default function TopTabs() {
  return (
    <Tab.Navigator
      tabBarOptions={{
        activeTintColor: 'black',
        // inactiveTintColor: 'grey',
        indicatorStyle: {
          // backgroundColor: 'red',
        },
        style: {
          // backgroundColor: '#8bb8ef',
        },
        labelStyle: {
          fontSize: 18,
          fontWeight: 'bold',
        },
      }}
    >
      <Tab.Screen
        name="bomb"
        component={ReshimatDrishotLebitzua}
      />
      <Tab.Screen name="frog" component={DrishotSheTuplu} />
    </Tab.Navigator>
  );
}

标签: javascriptreactjsreact-nativereact-navigation

解决方案


推荐阅读