在嵌套的React导航中,额外的标题空间位于顶部

时间:2019-04-05 04:28:32

标签: react-native react-navigation

额外的空白标题空间出现在屏幕顶部

我尝试将帖子屏幕的标题设置为空,但其他两个屏幕仍会出现空白。

enter image description here

 const Posts=createStackNavigator({
    Posts:{screen:createMaterialTopTabNavigator(screens,{
                        tabBarOptions: {
                          scrollEnabled: true,
                        },
                        animationEnabled:false,
                      })},
    VideoDetailScreen:{screen:VideoDetail},
    NewsDetailScreen:{screen:NewsDetail},
  });

  const AppContainer = createAppContainer(Posts);

2 个答案:

答案 0 :(得分:0)

我通过向navigationOptions添加选项来固定this workaround,如下所示:

navigationOptions: {
    ...
    headerForceInset: { top: 'never', bottom: 'never' },
},

答案 1 :(得分:0)

您需要传递headerMode:'none'

export default StackNavigator({
    LoginScreen: { screen: Login.component }
}, {
    initialRouteName: 'LoginScreen',
    headerMode: 'none' 
})