Javascript 对子对象隐藏CreateBoottomTabNavigator
我正在用Expo构建一个应用程序,当用户第一次打开应用程序时,我希望有一个欢迎屏幕。我需要“欢迎”和“授权”屏幕的选项卡栏在导航到“地图”屏幕后隐藏起来 使用react navigation中更新的createBottomTabNavigator,我无法将嵌套子项的底部选项卡设置为可见false 这是我的App.js文件: 从“世博会”导入世博会; 从“React”导入React; 从“react native”导入{Text,View}; 导入{ createStackNavigator, CreateBoottomTabNavigator, createAppContainer }从“反应导航”; 从'react redux'导入{Provider}; 从“./store”导入存储; 从“/screens/AuthScreen”导入AuthScreen; 从“./screens/WelcomeScreen”导入WelcomeScreen; 从“./screens/MapScreen”导入MapScreen; 从“./screens/DeckScreen”导入DeckScreen; 从“/screens/ReviewScreen”导入ReviewScreen; 从“/screens/SettingsScreen”导入设置屏幕; 导出默认类App扩展React.Component{ 渲染{ const MainNavigator=createAppContainer CreateBoottomTabNavigator{ 欢迎:{ 屏幕:WelcomeScreen, 导航选项:{tabBarVisible:false} }, 认证:{ 屏幕:AuthScreen, 导航选项:{tabBarVisible:false} }, 主要:CreateBoottomTabNavigator{ 地图:地图屏幕, 甲板:甲板屏风, 评论:createStackNavigator{ 回顾:回顾屏幕, 设置:设置屏幕 } } } ; 回来 ; } } 您可以使用传递给MapScreen的函数设置为false,如下所示:Javascript 对子对象隐藏CreateBoottomTabNavigator,javascript,react-native,navigationbar,react-native-navigation,Javascript,React Native,Navigationbar,React Native Navigation,我正在用Expo构建一个应用程序,当用户第一次打开应用程序时,我希望有一个欢迎屏幕。我需要“欢迎”和“授权”屏幕的选项卡栏在导航到“地图”屏幕后隐藏起来 使用react navigation中更新的createBottomTabNavigator,我无法将嵌套子项的底部选项卡设置为可见false 这是我的App.js文件: 从“世博会”导入世博会; 从“React”导入React; 从“react native”导入{Text,View}; 导入{ createStackNavigator,
constructor(props) {
this.state = {
isTabBarVisible: true,
}
this.hideTabBar = this.hideTabBar.bind(this);
}
hideTabBar() {
this.setState({ isTabBarVisible: false })
}
...
render() {
...
navigationOptions: { tabBarVisible: this.state.isTabBarVisible }
main: createBottomTabNavigator({
map: <MapScreen hideTabBar={this.hideTabBar}/>,
deck: DeckScreen,
review: createStackNavigator({
review: ReviewScreen,
settings: SettingsScreen
})
})
}
您可以使用传递给MapScreen的函数设置为false,如下所示:
constructor(props) {
this.state = {
isTabBarVisible: true,
}
this.hideTabBar = this.hideTabBar.bind(this);
}
hideTabBar() {
this.setState({ isTabBarVisible: false })
}
...
render() {
...
navigationOptions: { tabBarVisible: this.state.isTabBarVisible }
main: createBottomTabNavigator({
map: <MapScreen hideTabBar={this.hideTabBar}/>,
deck: DeckScreen,
review: createStackNavigator({
review: ReviewScreen,
settings: SettingsScreen
})
})
}
对于任何感兴趣的人,我找到了另一个解决方案: const MainNavigator=createAppContainer CreateBoottomTabNavigator{ 欢迎:{ 屏幕:WelcomeScreen, 导航选项:{tabBarVisible:false} }, 认证:{ 屏幕:AuthScreen, 导航选项:{tabBarVisible:false} }, //将导航选项添加到此屏幕 主要内容:{ 导航选项:{tabBarVisible:false}, 屏幕:CreateBoottomTabNavigator{ 地图:地图屏幕, 甲板:甲板屏风, 评论:createStackNavigator{ 回顾:回顾屏幕, 设置:设置屏幕 } } } }
; 对于任何感兴趣的人,我找到了另一个解决方案: const MainNavigator=createAppContainer CreateBoottomTabNavigator{ 欢迎:{ 屏幕:WelcomeScreen, 导航选项:{tabBarVisible:false} }, 认证:{ 屏幕:AuthScreen, 导航选项:{tabBarVisible:false} }, //将导航选项添加到此屏幕 主要内容:{ 导航选项:{tabBarVisible:false}, 屏幕:CreateBoottomTabNavigator{ 地图:地图屏幕, 甲板:甲板屏风, 评论:createStackNavigator{ 回顾:回顾屏幕, 设置:设置屏幕 } } } }
;它的工作,但它也增加了登录屏幕到tabbarit工作,但它也增加了登录屏幕到TabBar