Browse Source

Set TopBar default options

Guy Carmeli 6 years ago
parent
commit
2cc55ac06a

+ 4
- 4
lib/android/app/src/main/java/com/reactnativenavigation/parse/TopBarOptions.java View File

@@ -21,8 +21,8 @@ public class TopBarOptions implements DEFAULT_VALUES {
21 21
         options.textColor = ColorParser.parse(json, "textColor");
22 22
         options.textFontSize = FractionParser.parse(json, "textFontSize");
23 23
         options.textFontFamily = typefaceManager.getTypeFace(json.optString("textFontFamily", ""));
24
-        options.hidden = Options.BooleanOptions.parse(json.optString("hidden"));
25
-        options.animateHide = Options.BooleanOptions.parse(json.optString("animateHide"));
24
+        options.hidden = Options.BooleanOptions.parse(json.optString("hidden", "false"));
25
+        options.animateHide = Options.BooleanOptions.parse(json.optString("animateHide", "true"));
26 26
         options.hideOnScroll = Options.BooleanOptions.parse(json.optString("hideOnScroll"));
27 27
         options.drawBehind = Options.BooleanOptions.parse(json.optString("drawBehind"));
28 28
         options.rightButtons = Button.parseJsonArray(json.optJSONArray("rightButtons"));
@@ -38,8 +38,8 @@ public class TopBarOptions implements DEFAULT_VALUES {
38 38
     public Color textColor = new NullColor();
39 39
     public Fraction textFontSize = new NullFraction();
40 40
     @Nullable public Typeface textFontFamily;
41
-    public Options.BooleanOptions hidden = Options.BooleanOptions.NoValue;
42
-    public Options.BooleanOptions animateHide = Options.BooleanOptions.NoValue;
41
+    public Options.BooleanOptions hidden = Options.BooleanOptions.False;
42
+    public Options.BooleanOptions animateHide = Options.BooleanOptions.True;
43 43
     public Options.BooleanOptions hideOnScroll = Options.BooleanOptions.NoValue;
44 44
     public Options.BooleanOptions drawBehind = Options.BooleanOptions.NoValue;
45 45
     public ArrayList<Button> leftButtons;

+ 7
- 0
lib/android/app/src/test/java/com/reactnativenavigation/parse/OptionsTest.java View File

@@ -157,4 +157,11 @@ public class OptionsTest extends BaseTest {
157 157
         Options uut = new Options();
158 158
         assertThat(uut.topBarOptions.title.get("")).isEmpty();
159 159
     }
160
+
161
+    @Test
162
+    public void topBar_defaultOptions() throws Exception {
163
+        Options uut = new Options();
164
+        assertThat(uut.topBarOptions.hidden).isEqualTo(Options.BooleanOptions.False);
165
+        assertThat(uut.topBarOptions.animateHide).isEqualTo(Options.BooleanOptions.True);
166
+    }
160 167
 }