SideMenu布局示例react-native-navigation v2

时间:2018-08-24 16:11:21

标签: react-native-navigation

我需要使用sideMenu react-native-navigation v2的示例。理想情况下,我想从侧边菜单组件导航到其他屏幕(例如,带有底部标签的堆栈,帐户屏幕,常见问题解答屏幕)

当前这是我的布局

Navigation.setRoot({
  root: {
    sideMenu: {
      left: {
        component: {
          name: 'screen.SideMenu',
        }
      },
      center: {
        bottomTabs: {
          id: 'tabs',
          options: {
            topbar: {
              visible: true,
            }
          },
          children: [
            {
              stack: {
                id: 'tab1',
                children: [
                  {
                    component: {
                      name: 'screen.Home',
                      options: {
                        topbar: {
                          visible: true
                        },
                        bottomTab: {
                          fontSize: 12,
                          text: 'Home',
                          icon: homeIcon,
                          textColor: theme.$tabColor,
                          selectedTextColor: '#000',
                          selectedIconColor: '#000',
                        }
                      }
                    },
                  },
                ]
              }
            },
            {
              stack: {
                id: 'tab2',
                children: [
                  {
                    component: {
                      name: 'screen.Events',
                      options: {
                        bottomTab: {
                          text: 'Events',
                          fontSize: 12,
                          icon: eventsIcon,
                          textColor: theme.$tabColor,
                          selectedTextColor: '#000',
                          selectedIconColor: '#000',
                        }
                      }
                    },
                  },
                ]
              }
            },
          ],
        },
      }
    }
  }
});

在侧边菜单组件中,我正在调用此函数。

goToAccountsScreen = () => {
   console.log(this.props.componentId)
  Navigation.push(this.props.componentId, {
     component: {
         name: 'screen.Accounts',
     }
   })
}

如何将“帐户”屏幕添加到布局中

0 个答案:

没有答案