use of com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController in project react-native-navigation by wix.
the class NavigatorTest method pop_FromCorrectStackByFindingChildId_Promise.
@Test
public void pop_FromCorrectStackByFindingChildId_Promise() {
disablePushAnimation(child4);
StackController stack1 = newStack(child1);
final StackController stack2 = newStack(child2, child3);
BottomTabsController bottomTabsController = newTabs(Arrays.asList(stack1, stack2));
uut.setRoot(bottomTabsController, new CommandListenerAdapter(), reactInstanceManager);
idleMainLooper();
CommandListenerAdapter listener = spy(new CommandListenerAdapter() {
@Override
public void onSuccess(String childId) {
uut.pop("child4", Options.EMPTY, new CommandListenerAdapter());
assertThat(stack2.getChildControllers()).containsOnly(child2, child3);
}
});
stack2.push(child4, listener);
verify(listener).onSuccess(child4.getId());
}
use of com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController in project react-native-navigation by wix.
the class NavigatorTest method popToRoot.
@Test
public void popToRoot() {
StackController stack1 = newStack(child1);
StackController stack2 = newStack(child2, child3, child4);
BottomTabsController bottomTabsController = newTabs(Arrays.asList(stack1, stack2));
uut.setRoot(bottomTabsController, new CommandListenerAdapter(), reactInstanceManager);
stack2.push(child5, new CommandListenerAdapter() {
@Override
public void onSuccess(String childId) {
uut.popToRoot(child3.getId(), Options.EMPTY, new CommandListenerAdapter());
assertThat(stack2.getChildControllers()).containsOnly(child2);
}
});
}
use of com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController in project react-native-navigation by wix.
the class NavigatorTest method pop_FromCorrectStackByFindingChildId.
@Test
public void pop_FromCorrectStackByFindingChildId() {
StackController stack1 = newStack(child1);
StackController stack2 = newStack(child2);
BottomTabsController bottomTabsController = newTabs(Arrays.asList(stack1, stack2));
uut.setRoot(bottomTabsController, new CommandListenerAdapter(), reactInstanceManager);
stack2.push(child3, new CommandListenerAdapter() {
@Override
public void onSuccess(String childId) {
stack2.push(child4, new CommandListenerAdapter() {
@Override
public void onSuccess(String childId) {
uut.pop("child4", Options.EMPTY, new CommandListenerAdapter());
assertThat(stack2.getChildControllers()).containsOnly(child2, child3);
}
});
}
});
}
use of com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController in project react-native-navigation by wix.
the class NavigatorTest method push_OnCorrectStackByFindingChildId.
@Test
public void push_OnCorrectStackByFindingChildId() {
StackController stack1 = newStack();
stack1.ensureViewIsCreated();
StackController stack2 = newStack();
stack2.ensureViewIsCreated();
stack1.push(child1, new CommandListenerAdapter());
stack2.push(child2, new CommandListenerAdapter());
BottomTabsController bottomTabsController = newTabs(Arrays.asList(stack1, stack2));
uut.setRoot(bottomTabsController, new CommandListenerAdapter(), reactInstanceManager);
SimpleViewController newChild = new SimpleViewController(activity, childRegistry, "new child", tabOptions);
uut.push(child2.getId(), newChild, new CommandListenerAdapter());
assertThat(stack1.getChildControllers()).doesNotContain(newChild);
assertThat(stack2.getChildControllers()).contains(newChild);
}
use of com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController in project react-native-navigation by wix.
the class LayoutFactory method createBottomTabs.
private ViewController<?> createBottomTabs(LayoutNode node) {
List<ViewController<?>> tabs = map(node.children, this::create);
BottomTabsPresenter bottomTabsPresenter = new BottomTabsPresenter(tabs, defaultOptions, new BottomTabsAnimator());
return new BottomTabsController(activity, tabs, childRegistry, eventEmitter, new ImageLoader(), node.id, parseOptions(node.getOptions()), new Presenter(activity, defaultOptions), new BottomTabsAttacher(tabs, bottomTabsPresenter, defaultOptions), bottomTabsPresenter, new BottomTabPresenter(activity, tabs, new ImageLoader(), new TypefaceLoader(activity), defaultOptions));
}
Aggregations