Browse Source

Fix rebase issues

Guy Carmeli 6 years ago
parent
commit
fe442eb686

+ 0
- 2
lib/android/app/src/main/java/com/reactnativenavigation/parse/AnimationsOptions.java View File

@@ -1,8 +1,6 @@
1 1
 package com.reactnativenavigation.parse;
2 2
 
3 3
 
4
-import android.util.Log;
5
-
6 4
 import org.json.JSONObject;
7 5
 
8 6
 public class AnimationsOptions {

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

@@ -30,4 +30,8 @@ public class NestedAnimationsOptions {
30 30
         bottomTabs.mergeWithDefault(defaultOptions.bottomTabs);
31 31
         topBar.mergeWithDefault(defaultOptions.topBar);
32 32
     }
33
+
34
+    public boolean hasValue() {
35
+        return topBar.hasValue() || content.hasValue() || bottomTabs.hasValue();
36
+    }
33 37
 }

+ 14
- 6
lib/android/app/src/main/java/com/reactnativenavigation/presentation/OptionsPresenter.java View File

@@ -27,7 +27,7 @@ public class OptionsPresenter {
27 27
     public void applyChildOptions(Options options, Component child) {
28 28
         applyOrientation(options.orientationOptions);
29 29
         applyButtons(options.topBarOptions.leftButtons, options.topBarOptions.rightButtons);
30
-        applyTopBarOptions(options.topBarOptions, child, options.animationsOptions);
30
+        applyTopBarOptions(options.topBarOptions, options.animationsOptions, child);
31 31
         applyTopTabsOptions(options.topTabsOptions);
32 32
         applyTopTabOptions(options.topTabOptions);
33 33
     }
@@ -36,7 +36,7 @@ public class OptionsPresenter {
36 36
         ((Activity) topBar.getContext()).setRequestedOrientation(options.getValue());
37 37
     }
38 38
 
39
-    private void applyTopBarOptions(TopBarOptions options, Component component, AnimationsOptions animationOptions) {
39
+    private void applyTopBarOptions(TopBarOptions options, AnimationsOptions animationOptions, Component component) {
40 40
         if (options.title.text.hasValue()) topBar.setTitle(options.title.text.get());
41 41
         if (options.title.component.hasValue())
42 42
             topBar.setComponent(options.title.component.get(), options.title.alignment);
@@ -107,7 +107,7 @@ public class OptionsPresenter {
107 107
     public void mergeChildOptions(Options options, Component child) {
108 108
         mergeOrientation(options.orientationOptions);
109 109
         mergeButtons(options.topBarOptions.leftButtons, options.topBarOptions.rightButtons);
110
-        mergeTopBarOptions(options.topBarOptions, child);
110
+        mergeTopBarOptions(options.topBarOptions, options.animationsOptions, child);
111 111
         mergeTopTabsOptions(options.topTabsOptions);
112 112
         mergeTopTabOptions(options.topTabOptions);
113 113
     }
@@ -121,7 +121,7 @@ public class OptionsPresenter {
121 121
         if (rightButtons != null) topBar.setRightButtons(rightButtons);
122 122
     }
123 123
 
124
-    private void mergeTopBarOptions(TopBarOptions options, Component component) {
124
+    private void mergeTopBarOptions(TopBarOptions options, AnimationsOptions animationsOptions, Component component) {
125 125
         if (options.title.text.hasValue()) topBar.setTitle(options.title.text.get());
126 126
         if (options.title.component.hasValue()) topBar.setComponent(options.title.component.get(), options.title.alignment);
127 127
         if (options.background.color.hasValue()) topBar.setBackgroundColor(options.background.color);
@@ -131,10 +131,18 @@ public class OptionsPresenter {
131 131
 
132 132
         if (options.title.fontFamily != null) topBar.setTitleTypeface(options.title.fontFamily);
133 133
         if (options.visible.isFalse()) {
134
-            topBar.hide(options.animate);
134
+            if (options.animate.isTrueOrUndefined()) {
135
+                topBar.hideAnimate(animationsOptions.pop.topBar);
136
+            } else {
137
+                topBar.hide();
138
+            }
135 139
         }
136 140
         if (options.visible.isTrue()) {
137
-            topBar.show(options.animate);
141
+            if (options.animate.isTrueOrUndefined()) {
142
+                topBar.showAnimate(animationsOptions.push.topBar);
143
+            } else {
144
+                topBar.show();
145
+            }
138 146
         }
139 147
         if (options.drawBehind.isTrue()) {
140 148
             component.drawBehindTopBar();

+ 2
- 1
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsMergingTest.java View File

@@ -89,6 +89,7 @@ public class OptionsMergingTest extends BaseTest {
89 89
         options.topBarOptions.title = titleOptions;
90 90
         options.topBarOptions.background.color = new Color(0);
91 91
         options.topBarOptions.testId = new Text("test123");
92
+        options.topBarOptions.animate = new Bool(false);
92 93
         options.topBarOptions.visible = new Bool(false);
93 94
         options.topBarOptions.drawBehind = new Bool(false);
94 95
         options.topBarOptions.hideOnScroll = new Bool(false);
@@ -142,7 +143,7 @@ public class OptionsMergingTest extends BaseTest {
142 143
         verify(topBar, times(t)).setTitleFontSize(any());
143 144
         verify(topBar, times(t)).setTestId(any());
144 145
         verify(topBar, times(t)).setTitleTypeface(any());
145
-        verify(topBar, times(t)).hide(any());
146
+        verify(topBar, times(t)).hide();
146 147
         verify(child, times(t)).drawBelowTopBar(topBar);
147 148
         verify(child, times(0)).drawBehindTopBar();
148 149
     }

+ 2
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/StackControllerTest.java View File

@@ -10,7 +10,7 @@ import com.reactnativenavigation.mocks.MockPromise;
10 10
 import com.reactnativenavigation.mocks.SimpleViewController;
11 11
 import com.reactnativenavigation.mocks.TitleBarReactViewCreatorMock;
12 12
 import com.reactnativenavigation.mocks.TopBarButtonCreatorMock;
13
-import com.reactnativenavigation.parse.AnimationOptions;
13
+import com.reactnativenavigation.parse.NestedAnimationsOptions;
14 14
 import com.reactnativenavigation.parse.Options;
15 15
 import com.reactnativenavigation.parse.params.Bool;
16 16
 import com.reactnativenavigation.parse.params.Text;
@@ -517,7 +517,7 @@ public class StackControllerTest extends BaseTest {
517 517
         ParentController parentController = Mockito.mock(ParentController.class);
518 518
         uut.setParentController(parentController);
519 519
         Options options = new Options();
520
-        options.animationsOptions.push = AnimationOptions.parse(new JSONObject());
520
+        options.animationsOptions.push = NestedAnimationsOptions.parse(new JSONObject());
521 521
         options.topBarOptions.testId = new Text("id");
522 522
         options.fabOptions.id = new Text("fabId");
523 523
         Component component = mock(Component.class);

+ 2
- 1
playground/src/screens/OrientationDetectScreen.js View File

@@ -41,7 +41,8 @@ const styles = {
41 41
   root: {
42 42
     flexGrow: 1,
43 43
     justifyContent: 'center',
44
-    alignItems: 'center'
44
+    alignItems: 'center',
45
+    backgroundColor: 'white'
45 46
   },
46 47
   h1: {
47 48
     fontSize: 24,