Search in sources :

Example 6 with ScreenParams

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

the class ScreenParamsParser method parse.

@SuppressWarnings("ConstantConditions")
public static ScreenParams parse(Bundle params) {
    ScreenParams result = new ScreenParams();
    result.screenId = params.getString(KEY_SCREEN_ID);
    result.timestamp = params.getDouble(KEY_TIMESTAMP);
    assertKeyExists(params, KEY_NAVIGATION_PARAMS);
    result.navigationParams = new NavigationParams(params.getBundle(KEY_NAVIGATION_PARAMS));
    result.styleParams = new StyleParamsParser(params.getBundle(STYLE_PARAMS)).parse();
    result.title = params.getString(KEY_TITLE);
    result.subtitle = params.getString(KEY_SUBTITLE);
    result.rightButtons = ButtonParser.parseRightButton(params);
    result.overrideBackPressInJs = params.getBoolean(OVERRIDE_BACK_PRESS, false);
    result.leftButton = ButtonParser.parseLeftButton(params);
    result.topTabParams = parseTopTabs(params);
    if (hasKey(params, "screens")) {
        result.screens = parseScreens(params.getBundle("screens"));
    }
    if (hasKey(params, FRAGMENT_CREATOR_CLASS_NAME)) {
        result.fragmentCreatorClassName = params.getString(FRAGMENT_CREATOR_CLASS_NAME);
        result.fragmentCreatorPassProps = params.getBundle(FRAGMENT_CREATOR_PASS_PROPS);
    }
    result.fabParams = ButtonParser.parseFab(params, result.navigationParams.navigatorEventId, result.navigationParams.screenInstanceId);
    result.tabLabel = getTabLabel(params);
    result.tabIcon = new TabIconParser(params).parse();
    result.animateScreenTransitions = new AnimationParser(params).parse();
    result.sharedElementsTransitions = getSharedElementsTransitions(params);
    result.animationType = params.getString(ANIMATION_TYPE, AppStyle.appStyle.screenAnimationType);
    return result;
}
Also used : ScreenParams(com.reactnativenavigation.params.ScreenParams) NavigationParams(com.reactnativenavigation.params.NavigationParams)

Example 7 with ScreenParams

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

the class BottomTabs method addTabs.

public void addTabs(List<ScreenParams> params, OnTabSelectedListener onTabSelectedListener) {
    for (ScreenParams screenParams : params) {
        AHBottomNavigationItem item = new AHBottomNavigationItem(screenParams.tabLabel, screenParams.tabIcon, Color.GRAY);
        addItem(item);
        setOnTabSelectedListener(onTabSelectedListener);
    }
    setTitlesDisplayState();
}
Also used : ScreenParams(com.reactnativenavigation.params.ScreenParams) AHBottomNavigationItem(com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem)

Example 8 with ScreenParams

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

the class NavigationCommandsHandler method newStack.

public static void newStack(Bundle screenParams) {
    final NavigationActivity currentActivity = NavigationActivity.currentActivity;
    if (currentActivity == null) {
        return;
    }
    final ScreenParams params = ScreenParamsParser.parse(screenParams);
    NavigationApplication.instance.runOnMainThread(new Runnable() {

        @Override
        public void run() {
            currentActivity.newStack(params);
        }
    });
}
Also used : ScreenParams(com.reactnativenavigation.params.ScreenParams)

Aggregations

ScreenParams (com.reactnativenavigation.params.ScreenParams)8 AHBottomNavigationItem (com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem)1 NavigationParams (com.reactnativenavigation.params.NavigationParams)1 ScreenStack (com.reactnativenavigation.screens.ScreenStack)1