Search in sources :

Example 6 with Text

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

the class TitleBarHelper method iconButton.

public static ButtonOptions iconButton(String id, String icon) {
    ButtonOptions button = new ButtonOptions();
    button.id = "someButton";
    button.icon = new Text(icon);
    return button;
}
Also used : ButtonOptions(com.reactnativenavigation.options.ButtonOptions) Text(com.reactnativenavigation.options.params.Text)

Example 7 with Text

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

the class OptionsApplyingTest method reappliesOptionsOnMerge.

@Test
public void reappliesOptionsOnMerge() {
    assertThat(stack.getTopBar().getTitle()).isEmpty();
    stack.push(uut, new CommandListenerAdapter());
    Options opts = new Options();
    opts.topBar.title.text = new Text("the new title");
    uut.mergeOptions(opts);
    assertThat(stack.getTopBar().getTitle()).isEqualTo("the new title");
}
Also used : Options(com.reactnativenavigation.options.Options) Text(com.reactnativenavigation.options.params.Text) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 8 with Text

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

the class OptionsApplyingTest method mergeNavigationOptionsUpdatesCurrentOptions.

@Test
public void mergeNavigationOptionsUpdatesCurrentOptions() {
    assertThat(uut.options.topBar.title.text.get("")).isEmpty();
    Options options = new Options();
    options.topBar.title.text = new Text("new title");
    uut.mergeOptions(options);
    assertThat(uut.options.topBar.title.text.get()).isEqualTo("new title");
}
Also used : Options(com.reactnativenavigation.options.Options) Text(com.reactnativenavigation.options.params.Text) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 9 with Text

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

the class OptionsTest method clear_topTabOptions.

@Test
public void clear_topTabOptions() {
    Options uut = new Options();
    uut.topTabOptions.title = new Text("some title");
    uut.clearTopTabOptions();
    assertThat(uut.topTabOptions.title.hasValue()).isFalse();
}
Also used : Text(com.reactnativenavigation.options.params.Text) NullText(com.reactnativenavigation.options.params.NullText) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 10 with Text

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

the class OptionsTest method mergeDoesNotMutate.

@Test
public void mergeDoesNotMutate() throws Exception {
    JSONObject json1 = new JSONObject();
    json1.put("topBar", createTopBar(true));
    Options options1 = Options.parse(activity, mockLoader, json1);
    options1.topBar.title.text = new Text("some title");
    JSONObject json2 = new JSONObject();
    json2.put("topBar", createTopBar(false));
    Options options2 = Options.parse(activity, mockLoader, json2);
    options2.topBar.title.text = new NullText();
    Options merged = options1.mergeWith(options2);
    assertThat(options1.topBar.visible.get()).isTrue();
    assertThat(merged.topBar.visible.get()).isFalse();
    assertThat(merged.topBar.title.text.get()).isEqualTo("some title");
}
Also used : JSONObject(org.json.JSONObject) Text(com.reactnativenavigation.options.params.Text) NullText(com.reactnativenavigation.options.params.NullText) NullText(com.reactnativenavigation.options.params.NullText) 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