Everyone I am facing an issue in react-native as I am new to this .
I am callling a tabbpage from homePage
so in tabpage there is a navbar at the top,below this navbar a tabbar is showing two tabs.
This is good till now but the problem starts from here
In tabPage I have two tabs ->tab1 and tab2
from tab1 I am navigating to page MainPage1 where it is showing a Navbar below navbar a tabbar below tabbar an another navbar. As shown in the picture.
I am totally unable to remove both the top level navbar having title "Stopages" and the tabbar.
I am using Tabview for creating this tabbpage and using stacknavigator for navigating to different pages.I am stuck here and Not able to find solution
NOTE->I have tried using
navigationOptions: {
tabBar: ({ state }) => ({
visible: false
})
but its not doing anything Please help
class TabPage extends React.Component{
state = {
index: 0,
routes: [
{ key: 'Stopagess', title: 'Stopages' },
{ key: 'MapStopagess', title: 'Maps' },
],
};
render() {
return (
<TabView
navigationState={this.state}
renderScene={SceneMap({
Stopagess: Stopages,
MapStopagess: MapStopages,
})
}
renderTabBar={props =>
<TabBar
{...props}
style = {{backgroundColor:'#3f51b5'}}
indicatorStyle={{ color: 'pink' }}
/>
}
onIndexChange={index => this.setState({ index })}
initialLayout={{ width: Dimensions.get('window').width }}
indicatorStyle={{ backgroundColor: 'pink' }}
/>
);
}
}
This is my Stopages class
class Stopages extends Component {
render()
{
return (
<StopageDetail/>
)
}
}
const StopageDetail = createStackNavigator({
Stp:{
screen: Stpforsomeissue,
navigationOptions: () => ({
header:null,
tabBarVisible: false,
}),
},
NextDetailStopage:{
screen :StopageDetailOfStudents,
navigationOptions: ({ navigation, screenProps }) => ({
title: 'Stopages Detail',
// tabBarVisible: navigation.state.params=false,
headerStyle: { backgroundColor: '#ffd600'},
/>,
})
}
})
I believe you are using createMaterialTopNavigator under a root stack with routeName
Stopagesand under each Tab route you have a dedicated stack for each one, the first one being theStopages Detail. Please correct me if thats not the case and edit your post to show the navigation stack you have written.This might be useful to you:
The root stack can be like the one below:
and the TabNavigator will be like this:
The key to hide default stack navigator's header is to set it null in the navigationOptions.