use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class ParentControllerTest method findControllerById_Recursive.
@Test
public void findControllerById_Recursive() {
StackController stackController = TestUtils.newStackController(activity).build();
stackController.ensureViewIsCreated();
SimpleViewController child1 = new SimpleViewController(activity, childRegistry, "child1", new Options());
SimpleViewController child2 = new SimpleViewController(activity, childRegistry, "child2", new Options());
stackController.push(child1, new CommandListenerAdapter());
stackController.push(child2, new CommandListenerAdapter());
children.add(stackController);
assertThat(uut.findController("child2")).isEqualTo(child2);
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class TopTabsViewControllerTest method applyOptions_tabsAreRemovedAfterViewDisappears.
@Test
public void applyOptions_tabsAreRemovedAfterViewDisappears() {
StackController stackController = TestUtils.newStackController(activity).build();
stackController.ensureViewIsCreated();
ViewController<?> first = new SimpleViewController(activity, childRegistry, "first", Options.EMPTY);
disablePushAnimation(first, uut);
stackController.push(first, new CommandListenerAdapter());
stackController.push(uut, new CommandListenerAdapter());
uut.onViewWillAppear();
assertThat(ViewHelper.isVisible(stackController.getTopBar().getTopTabs())).isTrue();
disablePopAnimation(uut);
stackController.pop(Options.EMPTY, new CommandListenerAdapter());
first.onViewWillAppear();
assertThat(ViewHelper.isVisible(stackController.getTopBar().getTopTabs())).isFalse();
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class BottomTabsController method onTabSelected.
@Override
public boolean onTabSelected(int index, boolean wasSelected) {
ViewController<?> stack = tabs.get(index);
BottomTabOptions options = stack.resolveCurrentOptions().bottomTabOptions;
eventEmitter.emitBottomTabPressed(index);
if (options.selectTabOnPress.get(true)) {
eventEmitter.emitBottomTabSelected(bottomTabs.getCurrentItem(), index);
if (!wasSelected) {
selectTab(index);
}
}
if (options.popToRoot.get(false) && wasSelected && stack instanceof StackController) {
((StackController) stack).popToRoot(Options.EMPTY, new CommandListenerAdapter());
}
return false;
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class NavigatorTest method pop_byStackId.
@Test
public void pop_byStackId() {
disablePushAnimation(child1, child2);
disablePopAnimation(child2, child1);
StackController stack = newStack(child1, child2);
stack.ensureViewIsCreated();
uut.setRoot(stack, new CommandListenerAdapter(), reactInstanceManager);
uut.pop(stack.getId(), Options.EMPTY, new CommandListenerAdapter());
assertThat(stack.getChildControllers()).containsOnly(child1);
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class NavigatorTest method destroy_destroyedRoot.
@Test
public void destroy_destroyedRoot() {
disablePushAnimation(child1);
StackController spy = spy(parentController);
spy.options.animations.setRoot.getEnter().enabled = new Bool(false);
uut.setRoot(spy, new CommandListenerAdapter(), reactInstanceManager);
spy.push(child1, new CommandListenerAdapter());
activityController.destroy();
verify(spy, times(1)).destroy();
}
Aggregations