How to disable navigation bar for a specific screen in React-Nativa-Navigation V2?
Remove Navigation Bar from React-Native-Navigation v2?
1.6k views Asked by Payel Dutta At
4
There are 4 answers
0
On
For a specific component not showing topbar it can be done by putting
topBar: { visible: false }
in the options
of component
like so
Navigation.setRoot({
root: {
stack: {
id: "App",
children: [
{
component: {
name: "rci.Login",
options: {
topBar: {
visible: false
}
}
}
}
]
}
}
});
And also if it need to be set at the stack level so that no screen in the stack shows topbar we can do that by setting
options: {
topBar: {
visible: false
}
},
inside the stack. The whole code looks like
Navigation.setRoot({
root: {
stack: {
options: {
topBar: {
visible: false
}
},
children: [
{
component: {
name: 'navigation.playground.TextScreen',
passProps: {
text: 'This is tab 1',
myFunction: () => 'Hello from a function!',
}
}
},
{
component: {
name: 'navigation.playground.TextScreen',
passProps: {
text: 'This is tab 2',
}
}
}
]
}
}
});
0
On
Hope this helps. The correct way to do as of @react-navigation/native 5.1.3
seems to be this headerShown: false
<NavigationContainer>
<Stack.Navigator initialRouteName="Login">
<Stack.Screen
name="Login"
component={LoginScreen}
options={{ title: "Login Screen", headerShown: false }}
/>
{..other stuff..}
</Stack.Navigator>
</NavigationContainer>
If you are using a
StackNavigator
, you need to setheader
tonull
on a given screen: