Search in sources :

Example 1 with ActivityParams

use of com.reactnativenavigation.params.ActivityParams 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)

Aggregations

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