Search in sources :

Example 1 with SideMenuController

use of com.reactnativenavigation.viewcontrollers.sidemenu.SideMenuController in project react-native-navigation by wix.

the class LayoutFactory method createSideMenuRoot.

private ViewController<?> createSideMenuRoot(LayoutNode node) {
    SideMenuController sideMenuController = new SideMenuController(activity, childRegistry, node.id, parseOptions(node.getOptions()), new SideMenuPresenter(), new Presenter(activity, defaultOptions));
    ViewController<?> childControllerCenter = null, childControllerLeft = null, childControllerRight = null;
    for (LayoutNode child : node.children) {
        switch(child.type) {
            case SideMenuCenter:
                childControllerCenter = create(child);
                childControllerCenter.setParentController(sideMenuController);
                break;
            case SideMenuLeft:
                childControllerLeft = create(child);
                childControllerLeft.setParentController(sideMenuController);
                break;
            case SideMenuRight:
                childControllerRight = create(child);
                childControllerRight.setParentController(sideMenuController);
                break;
            default:
                throw new IllegalArgumentException("Invalid node type in sideMenu: " + node.type);
        }
    }
    if (childControllerCenter != null) {
        sideMenuController.setCenterController(childControllerCenter);
    }
    if (childControllerLeft != null) {
        sideMenuController.setLeftController(childControllerLeft);
    }
    if (childControllerRight != null) {
        sideMenuController.setRightController(childControllerRight);
    }
    return sideMenuController;
}
Also used : SideMenuPresenter(com.reactnativenavigation.viewcontrollers.sidemenu.SideMenuPresenter) SideMenuController(com.reactnativenavigation.viewcontrollers.sidemenu.SideMenuController) StackPresenter(com.reactnativenavigation.viewcontrollers.stack.StackPresenter) BottomTabPresenter(com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabPresenter) BottomTabsPresenter(com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsPresenter) SideMenuPresenter(com.reactnativenavigation.viewcontrollers.sidemenu.SideMenuPresenter) Presenter(com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter) ExternalComponentPresenter(com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentPresenter) ComponentPresenter(com.reactnativenavigation.viewcontrollers.component.ComponentPresenter)

Aggregations

BottomTabPresenter (com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabPresenter)1 BottomTabsPresenter (com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsPresenter)1 ComponentPresenter (com.reactnativenavigation.viewcontrollers.component.ComponentPresenter)1 ExternalComponentPresenter (com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentPresenter)1 SideMenuController (com.reactnativenavigation.viewcontrollers.sidemenu.SideMenuController)1 SideMenuPresenter (com.reactnativenavigation.viewcontrollers.sidemenu.SideMenuPresenter)1 StackPresenter (com.reactnativenavigation.viewcontrollers.stack.StackPresenter)1 Presenter (com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter)1