use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class BottomTabPresenterTest method createBottomTabs.
private void createBottomTabs(Options tab1Options, Options tab2Options, Options tab3Options) {
childRegistry = new ChildControllersRegistry();
bottomTabs = Mockito.mock(BottomTabs.class);
child1 = spy(new SimpleViewController(activity, childRegistry, "child1", tab1Options));
child2 = spy(new SimpleViewController(activity, childRegistry, "child2", tab2Options));
child3 = spy(new SimpleViewController(activity, childRegistry, "child2", tab3Options));
tabs = Arrays.asList(child1, child2, child3);
uut = new BottomTabPresenter(activity, tabs, ImageLoaderMock.mock(), new TypefaceLoaderMock(), new Options());
uut.bindView(bottomTabs);
uut.setDefaultOptions(new Options());
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class BottomTabPresenterTest method createTab1Options.
private Options createTab1Options() {
Options options = new Options();
options.bottomTabOptions.badge = new Text("tab1badge");
options.bottomTabOptions.iconColor = new ThemeColour(new Colour(Color.RED));
options.bottomTabOptions.selectedIconColor = new ThemeColour(new Colour(Color.RED));
return options;
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class BottomTabsController method handleBack.
@Override
public boolean handleBack(CommandListener listener) {
final boolean childBack = !tabs.isEmpty() && tabs.get(bottomTabs.getCurrentItem()).handleBack(listener);
final Options options = resolveCurrentOptions();
if (!childBack) {
if (options.hardwareBack.getBottomTabOnPress() instanceof HwBackBottomTabsBehaviour.PrevSelection) {
if (!selectionStack.isEmpty()) {
final int prevSelectedTabIndex = selectionStack.poll();
selectTab(prevSelectedTabIndex, false);
return true;
}
} else if (options.hardwareBack.getBottomTabOnPress() instanceof HwBackBottomTabsBehaviour.JumpToFirst) {
if (getSelectedIndex() != 0) {
selectTab(0, false);
return true;
} else {
return false;
}
} else {
return false;
}
}
return childBack;
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class ComponentPresenter method onConfigurationChanged.
public void onConfigurationChanged(ComponentLayout view, Options options) {
if (view == null)
return;
Options withDefault = options.withDefaultOptions(defaultOptions);
setBackgroundColor(view, withDefault);
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class ParentControllerTest method mergeOptions_optionsAreMergedWhenChildAppears.
@Test
public void mergeOptions_optionsAreMergedWhenChildAppears() {
Options options = new Options();
options.topBar.title.text = new Text("new title");
ViewController<?> child1 = spy(new SimpleViewController(activity, childRegistry, "child1", options));
children.add(child1);
uut.ensureViewIsCreated();
child1.ensureViewIsCreated();
child1.onViewWillAppear();
ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
verify(uut, times(1)).clearOptions();
verify(uut, times(1)).applyChildOptions(optionsCaptor.capture(), eq(child1));
assertThat(optionsCaptor.getValue().topBar.title.text.get()).isEqualTo("new title");
}
Aggregations