【发布时间】:2019-04-02 11:23:01
【问题描述】:
信息项目 “反应导航”:“^3.6.0”, “世博”:“^32.0.0”
我有一个 TabNavigator,在里面我有重定向到孩子,它们是 StackNavigator。问题是在孩子们中,我无法使用 tabBarVisible: false 隐藏 tabNavigator
父级(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);
孩子们(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);
视图(宽度导航选项)
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>
);
}
}
我在这里留下应用程序的代码
https://snack.expo.io/@ricarquico/clone-instagram
总之我想隐藏这个http://prntscr.com/n6hw68
【问题讨论】:
标签: javascript reactjs react-native react-navigation