react-native-navigation:如何隐藏所有屏幕的标题

时间:2019-08-02 03:10:22

标签: react-native react-navigation

我可以像这样hide header stackNavigator

const StackNavigator = createStackNavigator({
  ScreenOne:{
  screen:ScreenOne,
  navigationOptions: {
    header: null
    }
  }
})

但是,如果我有多个屏幕,并且想将header:null应用于所有屏幕,该如何设置navigationOptions? 例如,我尝试了此方法,但无法正常工作。

const StackNavigator = createStackNavigator({
    ScreenOne:ScreenOne,
    ScreenTwo:ScreenTwo,
    ScreenThree:ScreenThree,
    navigationOptions: {
        header: null
  }
})

2 个答案:

答案 0 :(得分:0)

from itertools import izip_longest

data = {} # initialize as dictionary

for index, task in enumerate(izip_longest(header,tasks)):
    key = task[0]
    val = task[1]

    if key is None:
      key = "task%d" % (index + 1) # if there are more tasks than headers

    data[key] = val 

答案 1 :(得分:0)

这样做吧:

const StackNavigator = createStackNavigator(
{
    ScreenOne:ScreenOne,
    ScreenTwo:ScreenTwo,
    ScreenThree:ScreenThree,
},
{
    headerMode:'none'
}
)