use of com.reactnativenavigation.viewcontrollers.component.ComponentViewController in project react-native-navigation by wix.
the class OptionsApplyingTest method beforeEach.
@Override
public void beforeEach() {
super.beforeEach();
activity = newActivity();
initialNavigationOptions = new Options();
view = spy(new TestComponentLayout(activity, new TestReactView(activity)));
view.asView().setLayoutParams(new RelativeLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
uut = new ComponentViewController(activity, new ChildControllersRegistry(), "componentId1", "componentName", (activity1, componentId, componentName) -> view, initialNavigationOptions, new Presenter(activity, new Options()), new ComponentPresenter(Options.EMPTY)) {
@Override
public boolean isViewShown() {
return true;
}
};
TopBarController topBarController = new TopBarController() {
@Override
protected TopBar createTopBar(Context context, StackLayout stackLayout) {
topBar = spy(super.createTopBar(context, stackLayout));
return topBar;
}
};
stack = TestUtils.newStackController(activity).setTopBarController(topBarController).build();
stack.ensureViewIsCreated();
stack.getView().layout(0, 0, 1000, 1000);
stack.getTopBar().layout(0, 0, 1000, 100);
activity.setContentView(stack.getView());
disablePushAnimation(uut);
}
use of com.reactnativenavigation.viewcontrollers.component.ComponentViewController 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;
}
use of com.reactnativenavigation.viewcontrollers.component.ComponentViewController in project react-native-navigation by wix.
the class LayoutFactory method createComponent.
private ViewController<?> createComponent(LayoutNode node) {
String id = node.id;
String name = node.data.optString("name");
return new ComponentViewController(activity, childRegistry, id, name, new ComponentViewCreator(reactInstanceManager), parseOptions(node.getOptions()), new Presenter(activity, defaultOptions), new ComponentPresenter(defaultOptions));
}
use of com.reactnativenavigation.viewcontrollers.component.ComponentViewController in project react-native-navigation by wix.
the class NavigatorTest method mergeOptions_CallsApplyNavigationOptions.
@Test
public void mergeOptions_CallsApplyNavigationOptions() {
ComponentViewController componentVc = new SimpleComponentViewController(activity, childRegistry, "theId", new Options());
componentVc.setParentController(parentController);
assertThat(componentVc.options.topBar.title.text.get("")).isEmpty();
uut.setRoot(componentVc, new CommandListenerAdapter(), reactInstanceManager);
Options options = new Options();
options.topBar.title.text = new Text("new title");
uut.mergeOptions("theId", options);
assertThat(componentVc.options.topBar.title.text.get()).isEqualTo("new title");
}
Aggregations