Info project "react-navigation": "^3.6.0", "expo": "^32.0.0"
I have a TabNavigator, inside this I have redirections to children, which are StackNavigator. The problem is that within the children, I can not hide the tabNavigator with tabBarVisible: false
THE PARENT (TabNavigator)
import React from 'react';
import { Text } from 'react-native';
import { createBottomTabNavigator, createStackNavigator, createAppContainer } from 'react-navigation';
import { Home, Search, Add, Follow, Profile } from '../screens';
import HomeNavigator from './Home';
import SearchNavigator from './Search';
const config = {
headerMode: 'none',
tabBarPosition: 'top'
};
const screens = {
Home: {
screen: HomeNavigator,
navigationOptions: ({navigation}) => ({
title: 'Home',
})
}
};
const Authenticated = createBottomTabNavigator(screens, config);
export default createAppContainer(Authenticated);
THE CHILDREN (StackNavigator)
import React from 'react';
import { createStackNavigator, createAppContainer } from 'react-navigation';
import { Home, Profile } from '../screens';
import { Posts, Comments } from '../screens/screensHome';
const screens = {
Home: {
screen: Home,
navigationOptions: {
header: null,
}
},
Comments: {
screen: Comments
}
};
const HomeNavigation = createStackNavigator(screens, config);
export default createAppContainer(HomeNavigation);
THE VIEW (width navigationOptions)
import React, { Component } from 'react';
import {
View,
Text,
StyleSheet,
} from 'react-native';
export default class Comments extends Component {
static navigationOptions = {
tabBarVisible: false
}
render() {
return (
<View>
<Text>I'm the Comments component</Text>
</View>
);
}
}
I leave here the code of the app
https://snack.expo.io/@ricarquico/clone-instagram
in short I want to hide this http://prntscr.com/n6hw68
I am not sure if you tried this. https://snack.expo.io/Sk7Go1WRM
Issue on Github: https://github.com/react-navigation/react-navigation-tabs/issues/19
StackA.navigationOptions = ({navigation})=>{
let { routeName } = navigation.state.routes[navigation.state.index];
let navigationOptions = {};
if (routeName === 'Comments') {
navigationOptions.tabBarVisible = false;
}
return navigationOptions;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.