Search in sources :

Example 16 with Options

use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.

the class BackButtonHelperTest method beforeEach.

@Override
public void beforeEach() {
    uut = new BackButtonHelper();
    Activity activity = newActivity();
    ChildControllersRegistry childRegistry = new ChildControllersRegistry();
    stack = TestUtils.newStackController(activity).setChildRegistry(childRegistry).setBackButtonHelper(uut).build();
    child1 = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
    child2 = spy(new SimpleViewController(activity, childRegistry, "child2", new Options()));
    stack.ensureViewIsCreated();
}
Also used : Options(com.reactnativenavigation.options.Options) BackButtonHelper(com.reactnativenavigation.viewcontrollers.stack.topbar.button.BackButtonHelper) Activity(android.app.Activity) ChildControllersRegistry(com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController)

Example 17 with Options

use of com.reactnativenavigation.options.Options 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)

Example 18 with Options

use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.

the class TopTabsViewControllerTest method createTabsControllers.

private List<ViewController<?>> createTabsControllers(Activity activity, List<Options> tabOptions) {
    List<ViewController<?>> tabControllers = new ArrayList<>(SIZE);
    for (int i = 0; i < SIZE; i++) {
        ComponentViewController viewController = new ComponentViewController(activity, childRegistry, "idTab" + i, "theComponentName", new TestComponentViewCreator(), tabOptions.get(i), new Presenter(activity, new Options()), new ComponentPresenter(Options.EMPTY));
        tabControllers.add(spy(viewController));
    }
    return tabControllers;
}
Also used : Options(com.reactnativenavigation.options.Options) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) ComponentViewController(com.reactnativenavigation.viewcontrollers.component.ComponentViewController) ViewController(com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController) TestComponentViewCreator(com.reactnativenavigation.mocks.TestComponentViewCreator) Presenter(com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter) ComponentPresenter(com.reactnativenavigation.viewcontrollers.component.ComponentPresenter) ArrayList(java.util.ArrayList) ComponentViewController(com.reactnativenavigation.viewcontrollers.component.ComponentViewController) ComponentPresenter(com.reactnativenavigation.viewcontrollers.component.ComponentPresenter)

Example 19 with Options

use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.

the class BottomTabsController method createView.

@NonNull
@Override
public BottomTabsLayout createView() {
    BottomTabsLayout root = new BottomTabsLayout(getActivity());
    this.bottomTabsContainer = createBottomTabsContainer();
    this.bottomTabs = bottomTabsContainer.getBottomTabs();
    Options resolveCurrentOptions = resolveCurrentOptions();
    tabsAttacher.init(root, resolveCurrentOptions);
    presenter.bindView(bottomTabsContainer, this);
    tabPresenter.bindView(bottomTabs);
    bottomTabs.setOnTabSelectedListener(this);
    root.addBottomTabsContainer(bottomTabsContainer);
    bottomTabs.addItems(createTabs());
    setInitialTab(resolveCurrentOptions);
    tabsAttacher.attach();
    return root;
}
Also used : BottomTabOptions(com.reactnativenavigation.options.BottomTabOptions) Options(com.reactnativenavigation.options.Options) BottomTabsLayout(com.reactnativenavigation.views.bottomtabs.BottomTabsLayout) NonNull(androidx.annotation.NonNull)

Example 20 with Options

use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.

the class NavigationModule method setDefaultOptions.

@ReactMethod
public void setDefaultOptions(ReadableMap options) {
    handle(() -> {
        Options defaultOptions = parse(options);
        layoutFactory.setDefaultOptions(defaultOptions);
        navigator().setDefaultOptions(defaultOptions);
    });
}
Also used : Options(com.reactnativenavigation.options.Options) ReactMethod(com.facebook.react.bridge.ReactMethod)

Aggregations

Options (com.reactnativenavigation.options.Options)110 BaseTest (com.reactnativenavigation.BaseTest)57 Test (org.junit.Test)57 SimpleViewController (com.reactnativenavigation.mocks.SimpleViewController)32 SideMenuOptions (com.reactnativenavigation.options.SideMenuOptions)19 CommandListenerAdapter (com.reactnativenavigation.react.CommandListenerAdapter)18 ChildControllersRegistry (com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry)16 Bool (com.reactnativenavigation.options.params.Bool)15 Text (com.reactnativenavigation.options.params.Text)15 OrientationOptions (com.reactnativenavigation.options.OrientationOptions)10 AnimationOptions (com.reactnativenavigation.options.AnimationOptions)9 ButtonOptions (com.reactnativenavigation.options.ButtonOptions)9 FrameLayout (android.widget.FrameLayout)8 SimpleComponentViewController (com.reactnativenavigation.mocks.SimpleComponentViewController)8 Presenter (com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter)8 ComponentOptions (com.reactnativenavigation.options.ComponentOptions)6 TopBarOptions (com.reactnativenavigation.options.TopBarOptions)6 TopTabOptions (com.reactnativenavigation.options.TopTabOptions)6 TopTabsOptions (com.reactnativenavigation.options.TopTabsOptions)6 Activity (android.app.Activity)5