Search in sources :

Example 11 with ScreenChangedEvent

use of com.reactnativenavigation.events.ScreenChangedEvent in project react-native-navigation by wix.

the class BottomTabsLayout method switchTab.

private void switchTab(int position, NavigationType navigationType) {
    hideCurrentStack();
    showNewStack(position, navigationType);
    EventBus.instance.post(new ScreenChangedEvent(getCurrentScreenStack().peek().getScreenParams()));
}
Also used : ScreenChangedEvent(com.reactnativenavigation.events.ScreenChangedEvent)

Example 12 with ScreenChangedEvent

use of com.reactnativenavigation.events.ScreenChangedEvent 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 13 with ScreenChangedEvent

use of com.reactnativenavigation.events.ScreenChangedEvent in project react-native-navigation by wix.

the class BottomTabsLayout method showInitialScreenStack.

private void showInitialScreenStack() {
    bottomTabs.setVisibilityByInitialScreen(getInitialScreenStack().peek().getStyleParams());
    showStackAndUpdateStyle(getInitialScreenStack(), NavigationType.InitialScreen);
    EventBus.instance.post(new ScreenChangedEvent(screenStacks[0].peek().getScreenParams()));
}
Also used : ScreenChangedEvent(com.reactnativenavigation.events.ScreenChangedEvent)

Example 14 with ScreenChangedEvent

use of com.reactnativenavigation.events.ScreenChangedEvent in project react-native-navigation by wix.

the class SingleScreenLayout method onBackPressed.

@Override
public boolean onBackPressed() {
    if (handleBackInJs()) {
        return true;
    }
    if (stack.canPop()) {
        stack.pop(true, System.currentTimeMillis());
        EventBus.instance.post(new ScreenChangedEvent(stack.peek().getScreenParams()));
        return true;
    } else {
        return false;
    }
}
Also used : ScreenChangedEvent(com.reactnativenavigation.events.ScreenChangedEvent)

Aggregations

ScreenChangedEvent (com.reactnativenavigation.events.ScreenChangedEvent)14 ScreenStack (com.reactnativenavigation.screens.ScreenStack)4 ViewPagerScreenChangedEvent (com.reactnativenavigation.events.ViewPagerScreenChangedEvent)1