小编Der*_*son的帖子

React Navigation:多个嵌套的导航器-堆栈-> Tab导航-> Tab导航/路由器(无法决定)->堆栈

编辑2019年4月:越简单越好,我最终为自己想要实现的目标推出了与导航无关的解决方案。凡是在这里发生的故障,无疑是我做错了。

因为我是受虐狂,所以我第一次使用react native时,我试图构建一个相对复杂的社交媒体应用程序(请注意,这是我的第一次,因此我可能完全做错了),其格式如下(伪代码):

Stack Navigator: 
    Home: BottomTabNavigator
    CreatePostScreen: CreatePostScreen
    CreatePostScreen2: CreatePostScreen2, etc
Run Code Online (Sandbox Code Playgroud)

(我在堆栈的最高级别具有“创建发布屏幕”,以便在加载该页面时,出于明显的原因它不会显示选项卡栏)

BottomTabNavigator = TabNavigator:
    Homescreen: HomeTabRouter (TabRouter, see below)
    Explore: ExploreNavigator (stack navigator, works fine)
    Notifications: NotificationsNavigator (stack navigator, works fine)
    Profile: ProfileNavigator (stack navigator, works fine)
Run Code Online (Sandbox Code Playgroud)

这就是它开始变得复杂的地方(这是实际的代码,我将在后面解释为什么我不能在选项卡导航器和选项卡路由器之间做出决定)

export const HomeTabNavigator = TabRouter({
    FriendsNavigator: {
        screen: FriendsNavigator,
        path: 'Friends',
        routeName: 'Friends',
    },
    LocalNavigator: {
        screen: LocalNavigator,       
        path: 'LocalScreen',
        routeName: 'LocalScreen'
    },

}, 
{
    headerMode: 'none',
}
)

const CustomTabView = ({ router, navigation }) => {
    const { …
Run Code Online (Sandbox Code Playgroud)

javascript react-native react-navigation

5
推荐指数
0
解决办法
1150
查看次数