Search in sources :

Example 31 with Text

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

the class TitleBarHelper method reactViewButton.

public static ButtonOptions reactViewButton(String name) {
    ButtonOptions button = new ButtonOptions();
    button.id = name + CompatUtils.generateViewId();
    button.component = new ComponentOptions();
    button.component.name = new Text("com.example" + name + CompatUtils.generateViewId());
    button.component.componentId = new Text(name + CompatUtils.generateViewId());
    return button;
}
Also used : ButtonOptions(com.reactnativenavigation.options.ButtonOptions) ComponentOptions(com.reactnativenavigation.options.ComponentOptions) Text(com.reactnativenavigation.options.params.Text)

Example 32 with Text

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

the class OptionsApplyingTest method initialOptionsAppliedOnAppear.

@Test
public void initialOptionsAppliedOnAppear() {
    uut.options.topBar.title.text = new Text("the title");
    StackController stackController = TestUtils.newStackController(activity).build();
    stackController.ensureViewIsCreated();
    stackController.push(uut, new CommandListenerAdapter());
    assertThat(stackController.getTopBar().getTitle()).isEmpty();
    uut.onViewWillAppear();
    assertThat(stackController.getTopBar().getTitle()).isEqualTo("the title");
}
Also used : StackController(com.reactnativenavigation.viewcontrollers.stack.StackController) Text(com.reactnativenavigation.options.params.Text) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 33 with Text

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

the class OptionsApplyingTest method appliesTopBarVisible.

@Test
public void appliesTopBarVisible() {
    stack.push(uut, new CommandListenerAdapter());
    assertThat(uut.initialOptions).isSameAs(initialNavigationOptions);
    initialNavigationOptions.topBar.title.text = new Text("the title");
    assertThat(stack.getTopBar().getVisibility()).isNotEqualTo(View.GONE);
    Options opts = new Options();
    opts.topBar.visible = new Bool(false);
    opts.topBar.animate = new Bool(false);
    uut.mergeOptions(opts);
    assertThat(stack.getTopBar().getVisibility()).isEqualTo(View.GONE);
}
Also used : Options(com.reactnativenavigation.options.Options) Bool(com.reactnativenavigation.options.params.Bool) Text(com.reactnativenavigation.options.params.Text) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 34 with Text

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

the class BottomTabPresenterTest method applyOptions_shouldPresentBadgeIfAvailable.

@Test
public void applyOptions_shouldPresentBadgeIfAvailable() {
    final Options tab1 = tab1Options.copy();
    tab1.bottomTabOptions.badge = new NullText();
    tab1.bottomTabOptions.badgeColor = new NullThemeColour();
    final Options tab2 = tab2Options.copy();
    tab2.bottomTabOptions.badge = new Text("Badge");
    tab2.bottomTabOptions.badgeColor = ThemeColour.of(Color.RED);
    createBottomTabs(tab1, tab2, new Options());
    uut.applyOptions();
    ArgumentCaptor<AHNotification> notificationArgumentCaptor = ArgumentCaptor.forClass(AHNotification.class);
    verify(bottomTabs).setNotification(notificationArgumentCaptor.capture(), eq(1));
    final AHNotification value = notificationArgumentCaptor.getValue();
    assertThat(value.getReadableText()).isEqualTo("Badge");
    assertThat(value.getBackgroundColor()).isEqualTo(Color.RED);
    verify(bottomTabs, never()).setNotification(notificationArgumentCaptor.capture(), eq(0));
    verify(bottomTabs, never()).setNotification(notificationArgumentCaptor.capture(), eq(2));
}
Also used : Options(com.reactnativenavigation.options.Options) NullThemeColour(com.reactnativenavigation.options.params.NullThemeColour) Text(com.reactnativenavigation.options.params.Text) NullText(com.reactnativenavigation.options.params.NullText) NullText(com.reactnativenavigation.options.params.NullText) AHNotification(com.aurelhubert.ahbottomnavigation.notification.AHNotification) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Aggregations

Text (com.reactnativenavigation.options.params.Text)34 BaseTest (com.reactnativenavigation.BaseTest)16 Test (org.junit.Test)16 Options (com.reactnativenavigation.options.Options)14 Colour (com.reactnativenavigation.options.params.Colour)8 NullText (com.reactnativenavigation.options.params.NullText)8 ThemeColour (com.reactnativenavigation.options.params.ThemeColour)8 ButtonOptions (com.reactnativenavigation.options.ButtonOptions)6 Bool (com.reactnativenavigation.options.params.Bool)6 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)4 Drawable (android.graphics.drawable.Drawable)4 MenuItem (android.view.MenuItem)4 CommandListenerAdapter (com.reactnativenavigation.react.CommandListenerAdapter)4 IconBackgroundDrawable (com.reactnativenavigation.views.stack.topbar.titlebar.IconBackgroundDrawable)4 NonNull (androidx.annotation.NonNull)3 SimpleViewController (com.reactnativenavigation.mocks.SimpleViewController)3 ComponentOptions (com.reactnativenavigation.options.ComponentOptions)3 NullThemeColour (com.reactnativenavigation.options.params.NullThemeColour)3 FabOptions (com.reactnativenavigation.options.FabOptions)2 IconBackgroundOptions (com.reactnativenavigation.options.IconBackgroundOptions)2