Search in sources :

Example 6 with ScreenStack

use of com.reactnativenavigation.screens.ScreenStack in project react-native-navigation by wix.

the class BottomTabsLayout method push.

@Override
public void push(ScreenParams params) {
    ScreenStack screenStack = getScreenStack(params.getNavigatorId());
    screenStack.push(params, createScreenLayoutParams(params));
    if (isCurrentStack(screenStack)) {
        bottomTabs.setStyleFromScreen(params.styleParams);
        EventBus.instance.post(new ScreenChangedEvent(params));
    }
}
Also used : ScreenStack(com.reactnativenavigation.screens.ScreenStack) ScreenChangedEvent(com.reactnativenavigation.events.ScreenChangedEvent)

Example 7 with ScreenStack

use of com.reactnativenavigation.screens.ScreenStack in project react-native-navigation by wix.

the class BottomTabsLayout method performOnStack.

private void performOnStack(String navigatorId, Task<ScreenStack> task, @Nullable Promise onPushComplete) {
    try {
        ScreenStack screenStack = getScreenStack(navigatorId);
        task.run(screenStack);
    } catch (ScreenStackNotFoundException e) {
        if (onPushComplete != null) {
            onPushComplete.reject("Navigation", "Could not perform action on stack [" + navigatorId + "]." + "This should not have happened, it probably means a navigator action" + "was called from an unmounted tab.");
        }
        Log.e("Navigation", "Could not perform action on stack [" + navigatorId + "]." + "This should not have happened, it probably means a navigator action" + "was called from an unmounted tab.");
    }
}
Also used : ScreenStack(com.reactnativenavigation.screens.ScreenStack)

Example 8 with ScreenStack

use of com.reactnativenavigation.screens.ScreenStack in project react-native-navigation by wix.

the class BottomTabsLayout method popToRoot.

@Override
public void popToRoot(final ScreenParams params) {
    performOnStack(params.getNavigatorId(), new Task<ScreenStack>() {

        @Override
        public void run(final ScreenStack stack) {
            stack.popToRoot(params.animateScreenTransitions, params.timestamp, new ScreenStack.OnScreenPop() {

                @Override
                public void onScreenPopAnimationEnd() {
                    if (isCurrentStack(stack)) {
                        setBottomTabsStyleFromCurrentScreen();
                        alignSnackbarContainerWithBottomTabs((LayoutParams) snackbarAndFabContainer.getLayoutParams(), params.styleParams);
                        EventBus.instance.post(new ScreenChangedEvent(stack.peek().getScreenParams()));
                    }
                }
            });
        }
    });
}
Also used : ScreenStack(com.reactnativenavigation.screens.ScreenStack) ScreenChangedEvent(com.reactnativenavigation.events.ScreenChangedEvent)

Example 9 with ScreenStack

use of com.reactnativenavigation.screens.ScreenStack in project react-native-navigation by wix.

the class SingleScreenLayout method createStack.

private void createStack(RelativeLayout parent) {
    if (stack != null) {
        stack.destroy();
    }
    stack = new ScreenStack(getActivity(), parent, screenParams.getNavigatorId(), this);
    LayoutParams lp = new LayoutParams(MATCH_PARENT, MATCH_PARENT);
    pushInitialScreen(lp);
    pushAdditionalScreens(lp);
}
Also used : ScreenStack(com.reactnativenavigation.screens.ScreenStack)

Aggregations

ScreenStack (com.reactnativenavigation.screens.ScreenStack)9 ScreenChangedEvent (com.reactnativenavigation.events.ScreenChangedEvent)4 ScreenParams (com.reactnativenavigation.params.ScreenParams)1