Search in sources :

Example 11 with Options

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

the class BackButtonHelper method addToPushedChild.

public void addToPushedChild(ViewController<?> child) {
    if (child.options.topBar.buttons.left != null || child.options.topBar.buttons.back.visible.isFalse())
        return;
    Options options = new Options();
    options.topBar.buttons.back.setVisible();
    child.mergeOptions(options);
}
Also used : Options(com.reactnativenavigation.options.Options)

Example 12 with Options

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

the class Presenter method onViewBroughtToFront.

public void onViewBroughtToFront(ViewController<?> viewController, Options options) {
    Options withDefaultOptions = options.copy().withDefaultOptions(defaultOptions);
    applyStatusBarOptions(viewController, withDefaultOptions);
}
Also used : NavigationBarOptions(com.reactnativenavigation.options.NavigationBarOptions) OrientationOptions(com.reactnativenavigation.options.OrientationOptions) Options(com.reactnativenavigation.options.Options) StatusBarOptions(com.reactnativenavigation.options.StatusBarOptions)

Example 13 with Options

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

the class Presenter method applyOptions.

public void applyOptions(ViewController view, Options options) {
    Options withDefaultOptions = options.copy().withDefaultOptions(defaultOptions);
    applyOrientation(withDefaultOptions.layout.orientation);
    applyViewOptions(view, withDefaultOptions);
    applyStatusBarOptions(view, withDefaultOptions);
    applyNavigationBarOptions(withDefaultOptions.navigationBar);
}
Also used : NavigationBarOptions(com.reactnativenavigation.options.NavigationBarOptions) OrientationOptions(com.reactnativenavigation.options.OrientationOptions) Options(com.reactnativenavigation.options.Options) StatusBarOptions(com.reactnativenavigation.options.StatusBarOptions)

Example 14 with Options

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

the class RootPresenter method setRoot.

public void setRoot(ViewController appearingRoot, ViewController<?> disappearingRoot, Options defaultOptions, CommandListener listener, ReactInstanceManager reactInstanceManager) {
    layoutDirectionApplier.apply(appearingRoot, defaultOptions, reactInstanceManager);
    rootLayout.addView(appearingRoot.getView(), matchParentWithBehaviour(new BehaviourDelegate(appearingRoot)));
    Options options = appearingRoot.resolveCurrentOptions(defaultOptions);
    AnimationOptions enter = options.animations.setRoot.getEnter();
    appearingRoot.setWaitForRender(enter.waitForRender);
    if (enter.waitForRender.isTrue()) {
        appearingRoot.getView().setAlpha(0);
        appearingRoot.addOnAppearedListener(() -> {
            if (appearingRoot.isDestroyed()) {
                listener.onError("Could not set root - Waited for the view to become visible but it was destroyed");
            } else {
                appearingRoot.getView().setAlpha(1);
                animateSetRootAndReportSuccess(appearingRoot, disappearingRoot, listener, options);
            }
        });
    } else {
        animateSetRootAndReportSuccess(appearingRoot, disappearingRoot, listener, options);
    }
}
Also used : Options(com.reactnativenavigation.options.Options) AnimationOptions(com.reactnativenavigation.options.AnimationOptions) AnimationOptions(com.reactnativenavigation.options.AnimationOptions) BehaviourDelegate(com.reactnativenavigation.views.BehaviourDelegate)

Example 15 with Options

use of com.reactnativenavigation.options.Options 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);
}
Also used : Options(com.reactnativenavigation.options.Options) StackController(com.reactnativenavigation.viewcontrollers.stack.StackController) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

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