TabBar inSide the StackNavigation in React Native

一曲冷凌霜 提交于 2019-12-24 22:06:09

问题


I will take StackNavigation for Push and Pop with its parameter. Its Working fine. But Now I want to implement after some screen TabBar after StackNavigation, Have any Idea How to Take TabBar after StackNavigation.

Note : I want to implement Custom TabBar.

Please help me.


回答1:


You can do something like

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
  }
});

Just declare your tabNavigator and its stackNavigators apart and then call them on the main stackNavigator.



来源:https://stackoverflow.com/questions/45726127/tabbar-inside-the-stacknavigation-in-react-native

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!