Search in sources :

Example 1 with SideMenuParams

use of com.reactnativenavigation.params.SideMenuParams in project react-native-navigation by wix.

the class ActivityParamsParser method parse.

public static ActivityParams parse(Bundle params) {
    ActivityParams result = new ActivityParams();
    AppStyle.setAppStyle(params);
    if (hasKey(params, "screen")) {
        result.type = ActivityParams.Type.SingleScreen;
        result.screenParams = ScreenParamsParser.parse(params.getBundle("screen"));
    }
    if (hasKey(params, "tabs")) {
        result.type = ActivityParams.Type.TabBased;
        result.tabParams = new ScreenParamsParser().parseTabs(params.getBundle("tabs"));
        if (result.tabParams.size() == 0) {
            throw new RuntimeException("Tried to start tab based app with zero tabs");
        }
    }
    if (hasKey(params, "sideMenu")) {
        SideMenuParams[] sideMenus = SideMenuParamsParser.parse(params.getBundle("sideMenu"));
        result.leftSideMenuParams = sideMenus[SideMenu.Side.Left.ordinal()];
        result.rightSideMenuParams = sideMenus[SideMenu.Side.Right.ordinal()];
    }
    result.animateShow = params.getBoolean("animateShow", true);
    return result;
}
Also used : ActivityParams(com.reactnativenavigation.params.ActivityParams) SideMenuParams(com.reactnativenavigation.params.SideMenuParams)

Example 2 with SideMenuParams

use of com.reactnativenavigation.params.SideMenuParams in project react-native-navigation by wix.

the class SideMenuParamsParser method parseSideMenu.

private static SideMenuParams parseSideMenu(@Nullable Bundle sideMenu, Side side) {
    if (sideMenu == null || sideMenu.isEmpty()) {
        return null;
    }
    SideMenuParams result = new SideMenuParams();
    result.screenId = sideMenu.getString("screenId");
    result.navigationParams = new NavigationParams(sideMenu.getBundle("navigationParams"));
    result.disableOpenGesture = sideMenu.getBoolean("disableOpenGesture", false);
    result.fixedWidth = sideMenu.getInt("fixedWidth", 0);
    result.side = side;
    return result;
}
Also used : SideMenuParams(com.reactnativenavigation.params.SideMenuParams) NavigationParams(com.reactnativenavigation.params.NavigationParams)

Aggregations

SideMenuParams (com.reactnativenavigation.params.SideMenuParams)2 ActivityParams (com.reactnativenavigation.params.ActivityParams)1 NavigationParams (com.reactnativenavigation.params.NavigationParams)1