Search in sources :

Example 1 with TopTabsLayoutCreator

use of com.reactnativenavigation.views.toptabs.TopTabsLayoutCreator in project react-native-navigation by wix.

the class LayoutFactory method createTopTabs.

private ViewController<?> createTopTabs(LayoutNode node) {
    final List<ViewController<?>> tabs = new ArrayList<>();
    for (int i = 0; i < node.children.size(); i++) {
        ViewController<?> tabController = create(node.children.get(i));
        Options options = parseOptions(node.children.get(i).getOptions());
        options.setTopTabIndex(i);
        tabs.add(tabController);
    }
    return new TopTabsController(activity, childRegistry, node.id, tabs, new TopTabsLayoutCreator(activity, tabs), parseOptions(node.getOptions()), new Presenter(activity, defaultOptions));
}
Also used : TopTabsLayoutCreator(com.reactnativenavigation.views.toptabs.TopTabsLayoutCreator) ComponentViewController(com.reactnativenavigation.viewcontrollers.component.ComponentViewController) ViewController(com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController) ExternalComponentViewController(com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentViewController) StackPresenter(com.reactnativenavigation.viewcontrollers.stack.StackPresenter) BottomTabPresenter(com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabPresenter) BottomTabsPresenter(com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsPresenter) SideMenuPresenter(com.reactnativenavigation.viewcontrollers.sidemenu.SideMenuPresenter) Presenter(com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter) ExternalComponentPresenter(com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentPresenter) ComponentPresenter(com.reactnativenavigation.viewcontrollers.component.ComponentPresenter) ArrayList(java.util.ArrayList) TopTabsController(com.reactnativenavigation.viewcontrollers.toptabs.TopTabsController)

Example 2 with TopTabsLayoutCreator

use of com.reactnativenavigation.views.toptabs.TopTabsLayoutCreator in project react-native-navigation by wix.

the class TopTabsViewControllerTest method beforeEach.

@Override
public void beforeEach() {
    super.beforeEach();
    activity = newActivity();
    childRegistry = new ChildControllersRegistry();
    List<Options> tabOptions = createOptions();
    tabControllers = createTabsControllers(activity, tabOptions);
    topTabsLayout = spy(new TopTabsViewPager(activity, tabControllers, new TopTabsAdapter(tabControllers)));
    TopTabsLayoutCreator layoutCreator = Mockito.mock(TopTabsLayoutCreator.class);
    Mockito.when(layoutCreator.create()).thenReturn(topTabsLayout);
    Presenter presenter = new Presenter(activity, new Options());
    options.topBar.buttons.back.visible = new Bool(false);
    uut = spy(new TopTabsController(activity, childRegistry, "componentId", tabControllers, layoutCreator, options, presenter));
    tabControllers.forEach(viewController -> viewController.setParentController(uut));
    stack = spy(TestUtils.newStackController(activity).build());
    stack.ensureViewIsCreated();
}
Also used : Options(com.reactnativenavigation.options.Options) TopTabsLayoutCreator(com.reactnativenavigation.views.toptabs.TopTabsLayoutCreator) Bool(com.reactnativenavigation.options.params.Bool) Presenter(com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter) ComponentPresenter(com.reactnativenavigation.viewcontrollers.component.ComponentPresenter) TopTabsViewPager(com.reactnativenavigation.views.toptabs.TopTabsViewPager) ChildControllersRegistry(com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry)

Aggregations

ComponentPresenter (com.reactnativenavigation.viewcontrollers.component.ComponentPresenter)2 Presenter (com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter)2 TopTabsLayoutCreator (com.reactnativenavigation.views.toptabs.TopTabsLayoutCreator)2 Options (com.reactnativenavigation.options.Options)1 Bool (com.reactnativenavigation.options.params.Bool)1 BottomTabPresenter (com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabPresenter)1 BottomTabsPresenter (com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsPresenter)1 ChildControllersRegistry (com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry)1 ComponentViewController (com.reactnativenavigation.viewcontrollers.component.ComponentViewController)1 ExternalComponentPresenter (com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentPresenter)1 ExternalComponentViewController (com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentViewController)1 SideMenuPresenter (com.reactnativenavigation.viewcontrollers.sidemenu.SideMenuPresenter)1 StackPresenter (com.reactnativenavigation.viewcontrollers.stack.StackPresenter)1 TopTabsController (com.reactnativenavigation.viewcontrollers.toptabs.TopTabsController)1 ViewController (com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController)1 TopTabsViewPager (com.reactnativenavigation.views.toptabs.TopTabsViewPager)1 ArrayList (java.util.ArrayList)1