基于选项卡的菜单,在一页上有侧边菜单

Tab based menu with side menu on one page

我正在尝试将基于选项卡的菜单和侧边栏菜单放在一个页面上以用于反应本机应用程序。现在只有其中一个出现,要么是基于选项卡的菜单,要么是侧边栏菜单。这是我的导航代码。我使用过 wix react-native-navigation。目标是使两个菜单都在单个屏幕上工作。请帮助。

Navigation.setRoot({
  root: {
    bottomTabs: {
      id: 'BottomTabsId',
      children: [
        {
          component: {
            name: 'SignIn',
            options: {
              bottomTab: {
                fontSize: 12,
                text: 'Sign In',
                icon: require('./signin.png')
              }
            }
          },
        },
        {
          component: {
            name: 'SignUp',
            options: {
              bottomTab: {
                text: 'Sign Up',
                fontSize: 12,
                icon: require('./signup.png')
              }
            }
          },
        },
      ],
    },
    sideMenu: {
      left: {
        component: {
          name: 'reactNativeInit.SideDrawer',
          passProps: {
            side: 'left'
          }
        }
      },
      center: {
        stack: {
          id: "stack1",
          children: [
            {
              component: {
                name: 'reactNativeInit.main'
              }
            }
          ]
        }
      },
      leftButtons: [
        {
          id: 'sideMenu'
        }
      ]
    }
  }
});

在 RNN 中,bottomTabs 和 sideMenu 是布局,可以组合在一起。 因此,不要使用 bottomTabs nav 作为主要布局,而是使用 sideMenu

Navigation.setRoot({
  root: {
    sideMenu: {
      left: {
        component: {
          name: 'reactNativeInit.SideDrawer',
          passProps: {
            side: 'left'
          }
        }
      },
      center: {
        stack: {
          id: "stack1",
          children: [
            {

              bottomTabs : {
                id: "bottomTabs",

                children: [
                  {
                    component: {
                      id: 0,
                      name: "navigation.DashboardScreen",
                      options: {
                        bottomTab: {
                          text: "Dashboard",
                          icon: require("../assets/icons/icon-check.png"),
                          iconColor: "#8b8b8b",
                          selectedIconColor: "rgb(35, 128, 187)"
                        }
                      }
                    }
                  },
                  {
                    component: {
                      id: 1,
                      name: "navigation.NotificationsScreen",
                      options: {
                        bottomTab: {
                          text: "Notifications",
                          icon: require("../assets/icons/icon-check.png"),
                          iconColor: "#8b8b8b",
                          selectedIconColor: "rgb(35, 128, 187)"
                        }
                      }
                    }
                  },
                  {
                    component: {
                      id: 2,
                      name: "navigation.MessagesScreen",
                      options: {
                        bottomTab: {
                          text: "Messages",
                          icon: require("../assets/icons/icon-check.png"),
                          iconColor: "#8b8b8b",
                          selectedIconColor: "rgb(35, 128, 187)"
                        }
                      }
                    }
                  },
                  {
                    component: {
                      id: 3,
                      name: "navigation.UsersScreen",
                      options: {
                        bottomTab: {
                          text: "Contacts",
                          icon: require("../assets/icons/icon-check.png"),
                          iconColor: "#8b8b8b",
                          selectedIconColor: "rgb(35, 128, 187)"
                        }
                      }
                    }
                  }
                ]
              }
            }
          ]
        }
      }
    }
  }
});