Search in sources :

Example 1 with BehaviourDelegate

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

the class ExternalComponentViewController method createView.

@Override
public ExternalComponentLayout createView() {
    ExternalComponentLayout content = new ExternalComponentLayout(getActivity());
    enableDrawingBehindStatusBar(content);
    content.addView(componentCreator.create(getActivity(), reactInstanceManager, externalComponent.passProps).asView(), CoordinatorLayoutUtils.matchParentWithBehaviour(new BehaviourDelegate(this)));
    return content;
}
Also used : BehaviourDelegate(com.reactnativenavigation.views.BehaviourDelegate) ExternalComponentLayout(com.reactnativenavigation.views.ExternalComponentLayout)

Example 2 with BehaviourDelegate

use of com.reactnativenavigation.views.BehaviourDelegate 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)

Aggregations

BehaviourDelegate (com.reactnativenavigation.views.BehaviourDelegate)2 AnimationOptions (com.reactnativenavigation.options.AnimationOptions)1 Options (com.reactnativenavigation.options.Options)1 ExternalComponentLayout (com.reactnativenavigation.views.ExternalComponentLayout)1