在React Native

时间:2017-06-07 05:58:10

标签: react-native-android

我试图在一个项目中一起实现Stack,Drawer和Tab Navigator,但它没有达到预期的效果。首先,创建了Tab导航器,一个是Home,另一个是Careers。接下来,创建Stack Navigator并在NavigationApp中以root身份集成抽屉。接下来,Creating Drawer Navigator将AppDrawer集成为root。

enter image description here

    import { StackNavigator } from 'react-navigation'
    import { TabNavigator } from 'react-navigation'
    import { DrawerNavigator } from 'react-navigation'
    import Register from './src/Register'
    import Home from './src/Home'
    import Products from './src/Products'
    import Openings from './src/Openings'
    import CareersPortal from './src/CareersPortal'
    export default class PageNavigation extends Component {
    render()
    {
     return (
     <NavigationApp/>  ); 
    }
    }


     const AppTab=TabNavigator({
     Home:{screen :Home },
     CareersPortal:{screen : CareersPortal},
     });



     const NavigationApp =StackNavigator({
     Openings:{screen:Openings},
     Register:{screen:Register},
     Home :{ screen: AppDrawer},
     });



     const AppDrawer= DrawerNavigator({
     Home:{screen: AppTab},
     Products:{screen :Products},
     }); 
     AppRegistry.registerComponent('PageNavigation', () => NavigationApp);


  Not integrated properly can anyone help me

1 个答案:

答案 0 :(得分:0)

您可以使用我发现非常方便的react-navigation v3x这种结构

  • AppSwitchNavigator
    • AppDrawerNavigator
      • DashboardStackNavigator
        • DashboardTabNavigator

您可以观看此视频,它可以为您详细解释所需的答案。

https://www.youtube.com/watch?v=w24FE9PZpzk