对某些屏幕的反应导航隐藏标题图标

发布于 2025-02-09 02:08:41 字数 1090 浏览 3 评论 0原文

我使用底部标签栏,对于第一个屏幕,我不想显示“回到”按钮图标。

我在标签顶部使用了标头

const AccountStack = ({navigation}) => {
  return (
    <>
      <View>
        <Icon                // this the back button 
          name="chevron-left"
          type="font-awesome"
          color={'#ffffff'}
          onPress={() => {
            navigation.pop();
          }}
        />
        <Image
          style={{height: 30, width: 170}}
          source={require('./src/assets/logo-white.png')}
        />
      </View>
      <Tab.Navigator
        initialRouteName={'WinterStack'}
        screenOptions={{
          headerShown: false,
          tabBarShowLabel: true,
          animation: 'fade',
        }}>
        <Tab.Screen
          name="WinterStack"
          component={WinterStack}/>

        <Tab.Screen
          name="SummerStack"
          component={SummerStack}/>

        <Tab.Screen
          name="SettingsStack"
          component={SettingsStack}/>
      </Tab.Navigator>
    </>
  );
};

i use bottom tab bar and for the first screens i don't want to show back button icon.

and i used header at the top of tab.navigator

is there a easy way to do it

const AccountStack = ({navigation}) => {
  return (
    <>
      <View>
        <Icon                // this the back button 
          name="chevron-left"
          type="font-awesome"
          color={'#ffffff'}
          onPress={() => {
            navigation.pop();
          }}
        />
        <Image
          style={{height: 30, width: 170}}
          source={require('./src/assets/logo-white.png')}
        />
      </View>
      <Tab.Navigator
        initialRouteName={'WinterStack'}
        screenOptions={{
          headerShown: false,
          tabBarShowLabel: true,
          animation: 'fade',
        }}>
        <Tab.Screen
          name="WinterStack"
          component={WinterStack}/>

        <Tab.Screen
          name="SummerStack"
          component={SummerStack}/>

        <Tab.Screen
          name="SettingsStack"
          component={SettingsStack}/>
      </Tab.Navigator>
    </>
  );
};

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

情丝乱 2025-02-16 02:08:41

您可以在选项卡上的“ screenoptions”上的“ screenoptions”上的标题内的后按钮放置视图。Navigator,然后在选项卡上设置“标题:false”。屏幕上的屏幕不显示所需的屏幕上的标题。

<Tab.Navigator
    initialRouteName={'WinterStack'}
    screenOptions={{
      header:()=> `ENTER YOUR VIEW HERE`,
      headerShown: true,
      tabBarShowLabel: true,
      animation: 'fade',
    }}>
    <Tab.Screen
      name="WinterStack"
      component={WinterStack}
      options={{
        headerShown:false,
      }}
      />

You can put the View with the back button inside header on 'screenOptions' on Tab.Navigator, then set 'headerShown:false' on Tab.Screen to not show the header on the screen you want.

<Tab.Navigator
    initialRouteName={'WinterStack'}
    screenOptions={{
      header:()=> `ENTER YOUR VIEW HERE`,
      headerShown: true,
      tabBarShowLabel: true,
      animation: 'fade',
    }}>
    <Tab.Screen
      name="WinterStack"
      component={WinterStack}
      options={{
        headerShown:false,
      }}
      />
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文