TabBar在React Native中支持StackNavigation

时间:2017-08-17 03:25:39

标签: react-native react-native-android react-native-ios react-native-0.46 stack-navigator

我将使用StackNavigation获取Push和Pop的参数。它的工作正常。但是现在我想在StackNavigation之后的一些屏幕TabBar之后实现,有任何想法如何在StackNavigation之后使用TabBar。

注意:我想实现Custom TabBar。

enter image description here

请帮帮我。

1 个答案:

答案 0 :(得分:2)

您可以执行类似

的操作
let StackWithTabs1 = StackNavigator({ // stackNavigator inside the tabNavigator
  Screen3:{
    screen: Screen3
  }
  ,Screen4:{
    screen: Screen4
  }
});

let StackWithTabs2 = StackNavigator({ // stackNavigator inside the tabNavigator
      Screen5:{
        screen: Screen5
      }
      ,Screen6:{
        screen: Screen6
      }
    });

let tab_bar = TabNavigator({
      StackWithTabs1 : {
        screen: StackWithTabs1 // Calling the stackNavigators that going to go inside the tabNavigator
      },
      StackWithTabs2 : {
        screen: StackWithTabs2 
      }
    });

let InitialStackNavigator = StackNavigator({
  Screen1: {
    screen: Screen1
  },
  Screen2: {
    screen: Screen2
  },
  tabBar: {
    screen: tab_bar // Calling the tabNavigator, wich contains the other stackNavigators
  }
});

只需声明您的tabNavigator及其stackNavigators,然后在主stackNavigator上调用它们。