更改TabBar中按钮的屏幕

问题描述 投票:1回答:1

我有两个主屏幕:

  • 首先(带有底部栏的3个标签)
  • 第二(标准新屏幕)

如何使BottomTabBar中的按钮单击以打开新屏幕?

默认情况下,底部栏中的按钮会打开一个新标签。我想要一个按钮来打开一个全新的屏幕

就像在屏幕上一样

enter image description here

带有标签的屏幕代码(3个元素):

function App() {
  return (
    <NavigationContainer>
      <Tab.Navigator tabBarOptions={{
        showLabel: true,
        style: {
          backgroundColor: 'transparent',
          position: 'absolute',
          borderTopWidth: 0,
          elevation: 0,
        }
      }}>
        <Tab.Screen name="Home" component={Home}/>
        <Tab.Screen name="Second" component={Second}/>
        <Tab.Screen name="Other" component={Other} />
      </Tab.Navigator>
    </NavigationContainer>
  );
}
react-native react-navigation
1个回答
© www.soinside.com 2019 - 2024. All rights reserved.