Browse Source

Remove animated option

Each animation (push, pop etc) can be enabled or disabled separately
Guy Carmeli 6 years ago
parent
commit
5e1d315b61
17 changed files with 158 additions and 161 deletions
  1. 6
    0
      lib/android/app/src/main/java/com/reactnativenavigation/parse/NestedAnimationsOptions.java
  2. 14
    26
      lib/android/app/src/main/java/com/reactnativenavigation/parse/Options.java
  3. 1
    1
      lib/android/app/src/main/java/com/reactnativenavigation/presentation/BottomTabsOptionsPresenter.java
  4. 11
    12
      lib/android/app/src/main/java/com/reactnativenavigation/presentation/OptionsPresenter.java
  5. 1
    1
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/Navigator.java
  6. 5
    5
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/StackController.java
  7. 1
    1
      lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/Modal.java
  8. 2
    2
      lib/android/app/src/main/java/com/reactnativenavigation/views/StackLayout.java
  9. 9
    0
      lib/android/app/src/test/java/com/reactnativenavigation/BaseTest.java
  10. 22
    22
      lib/android/app/src/test/java/com/reactnativenavigation/parse/OptionsTest.java
  11. 2
    5
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/FloatingActionButtonTest.java
  12. 6
    8
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/NavigatorTest.java
  13. 19
    19
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsApplyingTest.java
  14. 11
    11
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsMergingTest.java
  15. 5
    5
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/ParentControllerTest.java
  16. 37
    37
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/StackControllerTest.java
  17. 6
    6
      lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopTabsViewControllerTest.java

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

@@ -1,6 +1,9 @@
1 1
 package com.reactnativenavigation.parse;
2 2
 
3 3
 
4
+import com.reactnativenavigation.parse.params.Bool;
5
+import com.reactnativenavigation.parse.params.NullBool;
6
+
4 7
 import org.json.JSONObject;
5 8
 
6 9
 public class NestedAnimationsOptions {
@@ -15,6 +18,7 @@ public class NestedAnimationsOptions {
15 18
         return options;
16 19
     }
17 20
 
21
+    public Bool enabled = new NullBool();
18 22
     public AnimationOptions content = new AnimationOptions();
19 23
     public AnimationOptions bottomTabs = new AnimationOptions();
20 24
     public AnimationOptions topBar = new AnimationOptions();
@@ -23,12 +27,14 @@ public class NestedAnimationsOptions {
23 27
         topBar.mergeWith(other.topBar);
24 28
         content.mergeWith(other.content);
25 29
         bottomTabs.mergeWith(other.bottomTabs);
30
+        if (other.enabled.hasValue()) enabled = other.enabled;
26 31
     }
27 32
 
28 33
     void mergeWithDefault(NestedAnimationsOptions defaultOptions) {
29 34
         content.mergeWithDefault(defaultOptions.content);
30 35
         bottomTabs.mergeWithDefault(defaultOptions.bottomTabs);
31 36
         topBar.mergeWithDefault(defaultOptions.topBar);
37
+        if (!enabled.hasValue()) enabled = defaultOptions.enabled;
32 38
     }
33 39
 
34 40
     public boolean hasValue() {

+ 14
- 26
lib/android/app/src/main/java/com/reactnativenavigation/parse/Options.java View File

@@ -3,11 +3,8 @@ package com.reactnativenavigation.parse;
3 3
 import android.support.annotation.CheckResult;
4 4
 import android.support.annotation.NonNull;
5 5
 
6
-import com.reactnativenavigation.parse.params.Bool;
7 6
 import com.reactnativenavigation.parse.params.Color;
8
-import com.reactnativenavigation.parse.params.NullBool;
9 7
 import com.reactnativenavigation.parse.params.NullColor;
10
-import com.reactnativenavigation.parse.parsers.BoolParser;
11 8
 import com.reactnativenavigation.parse.parsers.ColorParser;
12 9
 import com.reactnativenavigation.utils.TypefaceLoader;
13 10
 
@@ -26,7 +23,7 @@ public class Options {
26 23
         if (json == null) return result.withDefaultOptions(defaultOptions);
27 24
 
28 25
         result.orientationOptions = OrientationOptions.parse(json);
29
-        result.topBarOptions = TopBarOptions.parse(typefaceManager, json.optJSONObject("topBar"));
26
+        result.topBar = TopBarOptions.parse(typefaceManager, json.optJSONObject("topBar"));
30 27
         result.topTabsOptions = TopTabsOptions.parse(json.optJSONObject("topTabs"));
31 28
         result.topTabOptions = TopTabOptions.parse(typefaceManager, json.optJSONObject("topTab"));
32 29
         result.bottomTabOptions = BottomTabOptions.parse(json.optJSONObject("bottomTab"));
@@ -34,24 +31,22 @@ public class Options {
34 31
         result.overlayOptions = OverlayOptions.parse(json.optJSONObject("overlay"));
35 32
         result.fabOptions = FabOptions.parse(json.optJSONObject("fab"));
36 33
         result.sideMenuRootOptions = SideMenuRootOptions.parse(json.optJSONObject("sideMenu"));
37
-        result.animationsOptions = AnimationsOptions.parse(json.optJSONObject("animations"));
38
-        result.animated = BoolParser.parse(json, "animated");
34
+        result.animations = AnimationsOptions.parse(json.optJSONObject("animations"));
39 35
         result.screenBackgroundColor = ColorParser.parse(json, "screenBackgroundColor");
40 36
 
41 37
         return result.withDefaultOptions(defaultOptions);
42 38
     }
43 39
 
44 40
     @NonNull public OrientationOptions orientationOptions = new OrientationOptions();
45
-    @NonNull public TopBarOptions topBarOptions = new TopBarOptions();
41
+    @NonNull public TopBarOptions topBar = new TopBarOptions();
46 42
     @NonNull public TopTabsOptions topTabsOptions = new TopTabsOptions();
47 43
     @NonNull public TopTabOptions topTabOptions = new TopTabOptions();
48 44
     @NonNull public BottomTabOptions bottomTabOptions = new BottomTabOptions();
49 45
     @NonNull public BottomTabsOptions bottomTabsOptions = new BottomTabsOptions();
50 46
     @NonNull public OverlayOptions overlayOptions = new OverlayOptions();
51 47
     @NonNull public FabOptions fabOptions = new FabOptions();
52
-    @NonNull public AnimationsOptions animationsOptions = new AnimationsOptions();
48
+    @NonNull public AnimationsOptions animations = new AnimationsOptions();
53 49
     @NonNull public SideMenuRootOptions sideMenuRootOptions = new SideMenuRootOptions();
54
-    @NonNull public Bool animated = new NullBool();
55 50
     @NonNull public Color screenBackgroundColor = new NullColor();
56 51
 
57 52
     void setTopTabIndex(int i) {
@@ -62,7 +57,7 @@ public class Options {
62 57
     public Options copy() {
63 58
         Options result = new Options();
64 59
         result.orientationOptions.mergeWith(orientationOptions);
65
-        result.topBarOptions.mergeWith(topBarOptions);
60
+        result.topBar.mergeWith(topBar);
66 61
         result.topTabsOptions.mergeWith(topTabsOptions);
67 62
         result.topTabOptions.mergeWith(topTabOptions);
68 63
         result.bottomTabOptions.mergeWith(bottomTabOptions);
@@ -70,8 +65,7 @@ public class Options {
70 65
         result.overlayOptions = overlayOptions;
71 66
         result.fabOptions.mergeWith(fabOptions);
72 67
         result.sideMenuRootOptions.mergeWith(sideMenuRootOptions);
73
-        result.animationsOptions.mergeWith(animationsOptions);
74
-        result.animated = animated;
68
+        result.animations.mergeWith(animations);
75 69
         result.screenBackgroundColor = screenBackgroundColor;
76 70
         return result;
77 71
     }
@@ -80,40 +74,34 @@ public class Options {
80 74
 	public Options mergeWith(final Options other) {
81 75
         Options result = copy();
82 76
         result.orientationOptions.mergeWith(other.orientationOptions);
83
-        result.topBarOptions.mergeWith(other.topBarOptions);
77
+        result.topBar.mergeWith(other.topBar);
84 78
         result.topTabsOptions.mergeWith(other.topTabsOptions);
85 79
         result.topTabOptions.mergeWith(other.topTabOptions);
86 80
         result.bottomTabOptions.mergeWith(other.bottomTabOptions);
87 81
         result.bottomTabsOptions.mergeWith(other.bottomTabsOptions);
88 82
         result.fabOptions.mergeWith(other.fabOptions);
89
-        result.animationsOptions.mergeWith(other.animationsOptions);
83
+        result.animations.mergeWith(other.animations);
90 84
         result.sideMenuRootOptions.mergeWith(other.sideMenuRootOptions);
91
-        if (other.animated.hasValue()) result.animated = other.animated;
92
-        if (other.screenBackgroundColor.hasValue()) {
93
-            result.screenBackgroundColor = other.screenBackgroundColor;
94
-        }
85
+        if (other.screenBackgroundColor.hasValue()) result.screenBackgroundColor = other.screenBackgroundColor;
95 86
         return result;
96 87
     }
97 88
 
98 89
     Options withDefaultOptions(final Options defaultOptions) {
99 90
         orientationOptions.mergeWithDefault(defaultOptions.orientationOptions);
100
-        topBarOptions.mergeWithDefault(defaultOptions.topBarOptions);
91
+        topBar.mergeWithDefault(defaultOptions.topBar);
101 92
         topTabOptions.mergeWithDefault(defaultOptions.topTabOptions);
102 93
         topTabsOptions.mergeWithDefault(defaultOptions.topTabsOptions);
103 94
         bottomTabOptions.mergeWithDefault(defaultOptions.bottomTabOptions);
104 95
         bottomTabsOptions.mergeWithDefault(defaultOptions.bottomTabsOptions);
105 96
         fabOptions.mergeWithDefault(defaultOptions.fabOptions);
106
-        animationsOptions.mergeWithDefault(defaultOptions.animationsOptions);
97
+        animations.mergeWithDefault(defaultOptions.animations);
107 98
         sideMenuRootOptions.mergeWithDefault(defaultOptions.sideMenuRootOptions);
108
-        if (!animated.hasValue()) animated = defaultOptions.animated;
109
-        if (!screenBackgroundColor.hasValue()) {
110
-            screenBackgroundColor = defaultOptions.screenBackgroundColor;
111
-        }
99
+        if (!screenBackgroundColor.hasValue()) screenBackgroundColor = defaultOptions.screenBackgroundColor;
112 100
         return this;
113 101
     }
114 102
 
115 103
     public Options clearTopBarOptions() {
116
-        topBarOptions = new TopBarOptions();
104
+        topBar = new TopBarOptions();
117 105
         return this;
118 106
     }
119 107
 
@@ -143,7 +131,7 @@ public class Options {
143 131
     }
144 132
 
145 133
     public Options clearAnimationOptions() {
146
-        animationsOptions = new AnimationsOptions();
134
+        animations = new AnimationsOptions();
147 135
         return this;
148 136
     }
149 137
 

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/presentation/BottomTabsOptionsPresenter.java View File

@@ -20,7 +20,7 @@ public class BottomTabsOptionsPresenter {
20 20
     }
21 21
 
22 22
     public void present(Options options) {
23
-        applyBottomTabsOptions(options.bottomTabsOptions, options.animationsOptions);
23
+        applyBottomTabsOptions(options.bottomTabsOptions, options.animations);
24 24
     }
25 25
 
26 26
     public void present(Options options, int tabIndex) {

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

@@ -9,7 +9,6 @@ import com.reactnativenavigation.parse.OrientationOptions;
9 9
 import com.reactnativenavigation.parse.TopBarOptions;
10 10
 import com.reactnativenavigation.parse.TopTabOptions;
11 11
 import com.reactnativenavigation.parse.TopTabsOptions;
12
-import com.reactnativenavigation.parse.params.Bool;
13 12
 import com.reactnativenavigation.parse.params.Button;
14 13
 import com.reactnativenavigation.utils.UiUtils;
15 14
 import com.reactnativenavigation.viewcontrollers.IReactView;
@@ -34,8 +33,8 @@ public class OptionsPresenter {
34 33
 
35 34
     public void applyChildOptions(Options options, Component child) {
36 35
         applyOrientation(options.orientationOptions);
37
-        applyButtons(options.topBarOptions.leftButtons, options.topBarOptions.rightButtons);
38
-        applyTopBarOptions(options.topBarOptions, options.animationsOptions, child, options.animated);
36
+        applyButtons(options.topBar.leftButtons, options.topBar.rightButtons);
37
+        applyTopBarOptions(options.topBar, options.animations, child, options);
39 38
         applyTopTabsOptions(options.topTabsOptions);
40 39
         applyTopTabOptions(options.topTabOptions);
41 40
     }
@@ -44,7 +43,7 @@ public class OptionsPresenter {
44 43
         ((Activity) topBar.getContext()).setRequestedOrientation(options.getValue());
45 44
     }
46 45
 
47
-    private void applyTopBarOptions(TopBarOptions options, AnimationsOptions animationOptions, Component component, Bool animated) {
46
+    private void applyTopBarOptions(TopBarOptions options, AnimationsOptions animationOptions, Component component, Options componentOptions) {
48 47
         topBar.setTitle(options.title.text.get(""));
49 48
         if (options.title.component.hasValue()) topBar.setTitleComponent(options.title.component);
50 49
         topBar.setTitleFontSize(options.title.fontSize.get(defaultTitleFontSize));
@@ -63,14 +62,14 @@ public class OptionsPresenter {
63 62
         if (options.testId.hasValue()) topBar.setTestId(options.testId.get());
64 63
 
65 64
         if (options.visible.isFalse()) {
66
-            if (options.animate.isTrueOrUndefined() && animated.isTrueOrUndefined()) {
65
+            if (options.animate.isTrueOrUndefined() && componentOptions.animations.push.enabled.isTrueOrUndefined()) {
67 66
                 topBar.hideAnimate(animationOptions.pop.topBar);
68 67
             } else {
69 68
                 topBar.hide();
70 69
             }
71 70
         }
72 71
         if (options.visible.isTrueOrUndefined()) {
73
-            if (options.animate.isTrueOrUndefined() && animated.isTrueOrUndefined()) {
72
+            if (options.animate.isTrueOrUndefined() && componentOptions.animations.push.enabled.isTrueOrUndefined()) {
74 73
                 topBar.showAnimate(animationOptions.push.topBar);
75 74
             } else {
76 75
                 topBar.show();
@@ -105,10 +104,10 @@ public class OptionsPresenter {
105 104
         if (topTabOptions.fontFamily != null) topBar.setTopTabFontFamily(topTabOptions.tabIndex, topTabOptions.fontFamily);
106 105
     }
107 106
 
108
-    public void onChildWillDisappear(Options disappearing, Options appearing) {
109
-        if (disappearing.topBarOptions.visible.isTrueOrUndefined() && appearing.topBarOptions.visible.isFalse()) {
110
-            if (disappearing.topBarOptions.animate.isTrueOrUndefined() && disappearing.animated.isTrueOrUndefined()) {
111
-                topBar.hideAnimate(disappearing.animationsOptions.pop.topBar);
107
+    public void onChildWillPop(Options disappearing, Options appearing) {
108
+        if (disappearing.topBar.visible.isTrueOrUndefined() && appearing.topBar.visible.isFalse()) {
109
+            if (disappearing.topBar.animate.isTrueOrUndefined() && disappearing.animations.pop.enabled.isTrueOrUndefined()) {
110
+                topBar.hideAnimate(disappearing.animations.pop.topBar);
112 111
             } else {
113 112
                 topBar.hide();
114 113
             }
@@ -117,8 +116,8 @@ public class OptionsPresenter {
117 116
 
118 117
     public void mergeChildOptions(Options options, Component child) {
119 118
         mergeOrientation(options.orientationOptions);
120
-        mergeButtons(options.topBarOptions.leftButtons, options.topBarOptions.rightButtons);
121
-        mergeTopBarOptions(options.topBarOptions, options.animationsOptions, child);
119
+        mergeButtons(options.topBar.leftButtons, options.topBar.rightButtons);
120
+        mergeTopBarOptions(options.topBar, options.animations, child);
122 121
         mergeTopTabsOptions(options.topTabsOptions);
123 122
         mergeTopTabOptions(options.topTabOptions);
124 123
     }

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/Navigator.java View File

@@ -77,7 +77,7 @@ public class Navigator extends ParentController implements ModalListener {
77 77
         root = viewController;
78 78
         View view = viewController.getView();
79 79
 
80
-        AnimationsOptions animationsOptions = viewController.options.animationsOptions;
80
+        AnimationsOptions animationsOptions = viewController.options.animations;
81 81
         getView().addView(view);
82 82
         if (animationsOptions.startApp.hasValue()) {
83 83
             new NavigationAnimator(viewController.getActivity(), animationsOptions)

+ 5
- 5
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/StackController.java View File

@@ -58,14 +58,14 @@ public class StackController extends ParentController<StackLayout> {
58 58
                         child
59 59
                 )
60 60
         );
61
-        animator.setOptions(options.animationsOptions);
61
+        animator.setOptions(options.animations);
62 62
     }
63 63
 
64 64
     @Override
65 65
     public void mergeChildOptions(Options options, Component child) {
66 66
         super.mergeChildOptions(options, child);
67 67
         getView().mergeChildOptions(options, child);
68
-        animator.mergeOptions(options.animationsOptions);
68
+        animator.mergeOptions(options.animations);
69 69
         if (options.fabOptions.hasValue() && child instanceof ReactComponent) {
70 70
             fabOptionsPresenter.mergeOptions(options.fabOptions, (ReactComponent) child, getView());
71 71
         }
@@ -96,7 +96,7 @@ public class StackController extends ParentController<StackLayout> {
96 96
         getView().addView(child.getView(), MATCH_PARENT, MATCH_PARENT);
97 97
 
98 98
         if (toRemove != null) {
99
-            if (child.options.animated.isTrueOrUndefined()) {
99
+            if (child.options.animations.push.enabled.isTrueOrUndefined()) {
100 100
                 animator.push(child.getView(), () -> {
101 101
                     getView().removeView(toRemove.getView());
102 102
                     listener.onSuccess(child.getId());
@@ -141,9 +141,9 @@ public class StackController extends ParentController<StackLayout> {
141 141
         disappearing.onViewWillDisappear();
142 142
         appearing.onViewWillAppear();
143 143
         getView().addView(appearing.getView(), 0);
144
-        getView().onChildWillDisappear(disappearing.options, appearing.options);
144
+        getView().onChildWillPop(disappearing.options, appearing.options);
145 145
 
146
-        if (disappearing.options.animated.isTrueOrUndefined()) {
146
+        if (disappearing.options.animations.pop.enabled.isTrueOrUndefined()) {
147 147
             animator.pop(disappearing.getView(), () -> finishPopping(disappearing, listener));
148 148
         } else {
149 149
             finishPopping(disappearing, listener);

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/Modal.java View File

@@ -31,7 +31,7 @@ public class Modal implements DialogInterface.OnKeyListener, DialogInterface.OnD
31 31
         dialog.setOnKeyListener(this);
32 32
         dialog.setOnDismissListener(this);
33 33
         dialog.setOnShowListener(this);
34
-        animator = new ModalAnimator(viewController.getActivity(), viewController.options.animationsOptions);
34
+        animator = new ModalAnimator(viewController.getActivity(), viewController.options.animations);
35 35
     }
36 36
 
37 37
     public void show() {

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/views/StackLayout.java View File

@@ -40,8 +40,8 @@ public class StackLayout extends RelativeLayout {
40 40
         optionsPresenter.applyChildOptions(options, child);
41 41
     }
42 42
 
43
-    public void onChildWillDisappear(Options disappearing, Options appearing) {
44
-        optionsPresenter.onChildWillDisappear(disappearing, appearing);
43
+    public void onChildWillPop(Options disappearing, Options appearing) {
44
+        optionsPresenter.onChildWillPop(disappearing, appearing);
45 45
     }
46 46
 
47 47
     public void mergeChildOptions(Options options, Component child) {

+ 9
- 0
lib/android/app/src/test/java/com/reactnativenavigation/BaseTest.java View File

@@ -4,6 +4,9 @@ import android.app.*;
4 4
 import android.support.v7.app.*;
5 5
 import android.view.*;
6 6
 
7
+import com.reactnativenavigation.parse.params.Bool;
8
+import com.reactnativenavigation.viewcontrollers.ViewController;
9
+
7 10
 import org.junit.*;
8 11
 import org.junit.runner.*;
9 12
 import org.robolectric.*;
@@ -41,4 +44,10 @@ public abstract class BaseTest {
41 44
         assertThat(child.getId()).isNotZero().isPositive();
42 45
         assertThat(parent.findViewById(child.getId())).isNull();
43 46
     }
47
+
48
+    protected void disablePushAnimation(ViewController... controllers) {
49
+        for (ViewController controller : controllers) {
50
+            controller.options.animations.push.enabled = new Bool(false);
51
+        }
52
+    }
44 53
 }

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

@@ -77,18 +77,18 @@ public class OptionsTest extends BaseTest {
77 77
     }
78 78
 
79 79
     private void assertResult(Options result) {
80
-        assertThat(result.topBarOptions.title.text.get()).isEqualTo(TITLE);
81
-        assertThat(result.topBarOptions.background.color.get()).isEqualTo(TOP_BAR_BACKGROUND_COLOR);
82
-        assertThat(result.topBarOptions.title.color.get()).isEqualTo(TOP_BAR_TEXT_COLOR);
83
-        assertThat(result.topBarOptions.title.fontSize.get()).isEqualTo(TOP_BAR_FONT_SIZE);
84
-        assertThat(result.topBarOptions.title.fontFamily).isEqualTo(TOP_BAR_TYPEFACE);
85
-        assertThat(result.topBarOptions.subtitle.color.get()).isEqualTo(SUBTITLE_TEXT_COLOR);
86
-        assertThat(result.topBarOptions.subtitle.fontSize.get()).isEqualTo(SUBTITLE_FONT_SIZE);
87
-        assertThat(result.topBarOptions.subtitle.alignment).isEqualTo(Alignment.fromString(SUBTITLE_ALIGNMENT));
88
-        assertThat(result.topBarOptions.subtitle.fontFamily).isEqualTo(SUBTITLE_TYPEFACE);
89
-        assertThat(result.topBarOptions.visible.get()).isEqualTo(TOP_BAR_VISIBLE.get());
90
-        assertThat(result.topBarOptions.drawBehind.get()).isEqualTo(TOP_BAR_DRAW_BEHIND.get());
91
-        assertThat(result.topBarOptions.hideOnScroll.get()).isEqualTo(TOP_BAR_HIDE_ON_SCROLL.get());
80
+        assertThat(result.topBar.title.text.get()).isEqualTo(TITLE);
81
+        assertThat(result.topBar.background.color.get()).isEqualTo(TOP_BAR_BACKGROUND_COLOR);
82
+        assertThat(result.topBar.title.color.get()).isEqualTo(TOP_BAR_TEXT_COLOR);
83
+        assertThat(result.topBar.title.fontSize.get()).isEqualTo(TOP_BAR_FONT_SIZE);
84
+        assertThat(result.topBar.title.fontFamily).isEqualTo(TOP_BAR_TYPEFACE);
85
+        assertThat(result.topBar.subtitle.color.get()).isEqualTo(SUBTITLE_TEXT_COLOR);
86
+        assertThat(result.topBar.subtitle.fontSize.get()).isEqualTo(SUBTITLE_FONT_SIZE);
87
+        assertThat(result.topBar.subtitle.alignment).isEqualTo(Alignment.fromString(SUBTITLE_ALIGNMENT));
88
+        assertThat(result.topBar.subtitle.fontFamily).isEqualTo(SUBTITLE_TYPEFACE);
89
+        assertThat(result.topBar.visible.get()).isEqualTo(TOP_BAR_VISIBLE.get());
90
+        assertThat(result.topBar.drawBehind.get()).isEqualTo(TOP_BAR_DRAW_BEHIND.get());
91
+        assertThat(result.topBar.hideOnScroll.get()).isEqualTo(TOP_BAR_HIDE_ON_SCROLL.get());
92 92
         assertThat(result.bottomTabsOptions.animate.get()).isEqualTo(BOTTOM_TABS_ANIMATE.get());
93 93
         assertThat(result.bottomTabsOptions.visible.get()).isEqualTo(BOTTOM_TABS_VISIBLE.get());
94 94
         assertThat(result.bottomTabsOptions.currentTabId.get()).isEqualTo(BOTTOM_TABS_CURRENT_TAB_ID);
@@ -196,17 +196,17 @@ public class OptionsTest extends BaseTest {
196 196
         JSONObject json1 = new JSONObject();
197 197
         json1.put("topBar", createTopBar(true));
198 198
         Options options1 = Options.parse(mockLoader, json1);
199
-        options1.topBarOptions.title.text = new Text("some title");
199
+        options1.topBar.title.text = new Text("some title");
200 200
 
201 201
         JSONObject json2 = new JSONObject();
202 202
         json2.put("topBar", createTopBar(false));
203 203
         Options options2 = Options.parse(mockLoader, json2);
204
-        options2.topBarOptions.title.text = new NullText();
204
+        options2.topBar.title.text = new NullText();
205 205
 
206 206
         Options merged = options1.mergeWith(options2);
207
-        assertThat(options1.topBarOptions.visible.get()).isTrue();
208
-        assertThat(merged.topBarOptions.visible.get()).isFalse();
209
-        assertThat(merged.topBarOptions.title.text.get()).isEqualTo("some title");
207
+        assertThat(options1.topBar.visible.get()).isTrue();
208
+        assertThat(merged.topBar.visible.get()).isFalse();
209
+        assertThat(merged.topBar.title.text.get()).isEqualTo("some title");
210 210
     }
211 211
 
212 212
     @Test
@@ -242,7 +242,7 @@ public class OptionsTest extends BaseTest {
242 242
     @Test
243 243
     public void defaultEmptyOptions() {
244 244
         Options uut = new Options();
245
-        assertThat(uut.topBarOptions.title.text.get("")).isEmpty();
245
+        assertThat(uut.topBar.title.text.get("")).isEmpty();
246 246
         assertThat(uut.screenBackgroundColor.hasValue()).isFalse();
247 247
 
248 248
     }
@@ -250,16 +250,16 @@ public class OptionsTest extends BaseTest {
250 250
     @Test
251 251
     public void topBar_defaultOptions() {
252 252
         Options uut = new Options();
253
-        assertThat(uut.topBarOptions.visible.isFalseOrUndefined()).isTrue();
254
-        assertThat(uut.topBarOptions.animate.isTrueOrUndefined()).isTrue();
253
+        assertThat(uut.topBar.visible.isFalseOrUndefined()).isTrue();
254
+        assertThat(uut.topBar.animate.isTrueOrUndefined()).isTrue();
255 255
     }
256 256
 
257 257
     @Test
258 258
     public void clear_topBarOptions() {
259 259
         Options uut = new Options();
260
-        uut.topBarOptions.title.text = new Text("some title");
260
+        uut.topBar.title.text = new Text("some title");
261 261
         uut.clearTopBarOptions();
262
-        assertThat(uut.topBarOptions.title.text.hasValue()).isFalse();
262
+        assertThat(uut.topBar.title.text.hasValue()).isFalse();
263 263
     }
264 264
 
265 265
     @Test

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

@@ -12,7 +12,6 @@ import com.reactnativenavigation.mocks.TopBarBackgroundViewCreatorMock;
12 12
 import com.reactnativenavigation.mocks.TopBarButtonCreatorMock;
13 13
 import com.reactnativenavigation.parse.FabOptions;
14 14
 import com.reactnativenavigation.parse.Options;
15
-import com.reactnativenavigation.parse.params.Bool;
16 15
 import com.reactnativenavigation.parse.params.Text;
17 16
 import com.reactnativenavigation.utils.CommandListenerAdapter;
18 17
 import com.reactnativenavigation.viewcontrollers.topbar.TopBarBackgroundViewController;
@@ -47,7 +46,6 @@ public class FloatingActionButtonTest extends BaseTest {
47 46
     @NonNull
48 47
     private Options getOptionsWithFab() {
49 48
         Options options = new Options();
50
-        options.animated = new Bool(false);
51 49
         FabOptions fabOptions = new FabOptions();
52 50
         fabOptions.id = new Text("FAB");
53 51
         options.fabOptions = fabOptions;
@@ -100,6 +98,7 @@ public class FloatingActionButtonTest extends BaseTest {
100 98
 
101 99
     @Test
102 100
     public void hideOnPop() {
101
+        disablePushAnimation(childNoFab, childFab);
103 102
         stackController.push(childNoFab, new CommandListenerAdapter());
104 103
         stackController.push(childFab, new CommandListenerAdapter());
105 104
         childFab.onViewAppeared();
@@ -111,9 +110,7 @@ public class FloatingActionButtonTest extends BaseTest {
111 110
 
112 111
     @Test
113 112
     public void showOnPop() {
114
-        childFab.options.animated = new Bool(false);
115
-        childNoFab.options.animated = new Bool(false);
116
-
113
+        disablePushAnimation(childFab, childNoFab);
117 114
         stackController.push(childFab, new CommandListenerAdapter());
118 115
         stackController.push(childNoFab, new CommandListenerAdapter());
119 116
         childNoFab.onViewAppeared();

+ 6
- 8
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/NavigatorTest.java View File

@@ -213,9 +213,7 @@ public class NavigatorTest extends BaseTest {
213 213
 
214 214
     @Test
215 215
     public void setStackRoot() {
216
-        child1.options.animated = new Bool(false);
217
-        child2.options.animated = new Bool(false);
218
-        child3.options.animated = new Bool(false);
216
+        disablePushAnimation(child1, child2, child3);
219 217
 
220 218
         StackController stack = newStack();
221 219
         uut.setRoot(stack, new MockPromise());
@@ -248,14 +246,14 @@ public class NavigatorTest extends BaseTest {
248 246
     public void setOptions_CallsApplyNavigationOptions() {
249 247
         ComponentViewController componentVc = new SimpleComponentViewController(activity, "theId", new Options());
250 248
         componentVc.setParentController(parentController);
251
-        assertThat(componentVc.options.topBarOptions.title.text.get("")).isEmpty();
249
+        assertThat(componentVc.options.topBar.title.text.get("")).isEmpty();
252 250
         uut.setRoot(componentVc, new MockPromise());
253 251
 
254 252
         Options options = new Options();
255
-        options.topBarOptions.title.text = new Text("new title");
253
+        options.topBar.title.text = new Text("new title");
256 254
 
257 255
         uut.setOptions("theId", options);
258
-        assertThat(componentVc.options.topBarOptions.title.text.get()).isEqualTo("new title");
256
+        assertThat(componentVc.options.topBar.title.text.get()).isEqualTo("new title");
259 257
     }
260 258
 
261 259
     @Test
@@ -348,8 +346,8 @@ public class NavigatorTest extends BaseTest {
348 346
 
349 347
     @Test
350 348
     public void pushedStackCanBePopped() {
351
-        child1.options.animated = new Bool(false);
352
-        child2.options.animated = new Bool(false);
349
+        child1.options.animations.push.enabled = new Bool(false);
350
+        child2.options.animations.push.enabled = new Bool(false);
353 351
         StackController parent = newStack();
354 352
         parent.ensureViewIsCreated();
355 353
         uut.setRoot(parent, new MockPromise());

+ 19
- 19
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsApplyingTest.java View File

@@ -71,7 +71,7 @@ public class OptionsApplyingTest extends BaseTest {
71 71
 
72 72
     @Test
73 73
     public void initialOptionsAppliedOnAppear() {
74
-        uut.options.topBarOptions.title.text = new Text("the title");
74
+        uut.options.topBar.title.text = new Text("the title");
75 75
         StackController stackController =
76 76
                 new StackController(activity, new TopBarButtonCreatorMock(), new TitleBarReactViewCreatorMock(), new TopBarBackgroundViewController(activity, new TopBarBackgroundViewCreatorMock()), new TopBarController(), "stackId", new Options());
77 77
         stackController.push(uut, new CommandListenerAdapter());
@@ -84,11 +84,11 @@ public class OptionsApplyingTest extends BaseTest {
84 84
     @Test
85 85
     public void mergeNavigationOptionsUpdatesCurrentOptions() {
86 86
         uut.ensureViewIsCreated();
87
-        assertThat(uut.options.topBarOptions.title.text.get("")).isEmpty();
87
+        assertThat(uut.options.topBar.title.text.get("")).isEmpty();
88 88
         Options options = new Options();
89
-        options.topBarOptions.title.text = new Text("new title");
89
+        options.topBar.title.text = new Text("new title");
90 90
         uut.mergeOptions(options);
91
-        assertThat(uut.options.topBarOptions.title.text.get()).isEqualTo("new title");
91
+        assertThat(uut.options.topBar.title.text.get()).isEqualTo("new title");
92 92
     }
93 93
 
94 94
     @Test
@@ -98,7 +98,7 @@ public class OptionsApplyingTest extends BaseTest {
98 98
         assertThat(stackController.getTopBar().getTitle()).isEmpty();
99 99
 
100 100
         Options opts = new Options();
101
-        opts.topBarOptions.title.text = new Text("the new title");
101
+        opts.topBar.title.text = new Text("the new title");
102 102
         uut.mergeOptions(opts);
103 103
 
104 104
         assertThat(stackController.getTopBar().getTitle()).isEqualTo("the new title");
@@ -110,7 +110,7 @@ public class OptionsApplyingTest extends BaseTest {
110 110
         uut.onViewAppeared();
111 111
 
112 112
         Options opts = new Options();
113
-        opts.topBarOptions.background.color = new com.reactnativenavigation.parse.params.Color(Color.RED);
113
+        opts.topBar.background.color = new com.reactnativenavigation.parse.params.Color(Color.RED);
114 114
         uut.mergeOptions(opts);
115 115
 
116 116
         assertThat(((ColorDrawable) stackController.getTopBar().getTitleBar().getBackground()).getColor()).isEqualTo(Color.RED);
@@ -123,8 +123,8 @@ public class OptionsApplyingTest extends BaseTest {
123 123
             @Override
124 124
             public void onSuccess(String childId) {
125 125
                 Options opts = new Options();
126
-                opts.topBarOptions.title.text = new Text("the title");
127
-                opts.topBarOptions.title.color = new com.reactnativenavigation.parse.params.Color(Color.RED);
126
+                opts.topBar.title.text = new Text("the title");
127
+                opts.topBar.title.color = new com.reactnativenavigation.parse.params.Color(Color.RED);
128 128
                 uut.mergeOptions(opts);
129 129
 
130 130
                 assertThat(stackController.getTopBar().getTitleTextView()).isNotEqualTo(null);
@@ -136,13 +136,13 @@ public class OptionsApplyingTest extends BaseTest {
136 136
     @Test
137 137
     public void appliesTopBarTextSize() {
138 138
         assertThat(uut.initialOptions).isSameAs(initialNavigationOptions);
139
-        initialNavigationOptions.topBarOptions.title.text = new Text("the title");
139
+        initialNavigationOptions.topBar.title.text = new Text("the title");
140 140
         uut.ensureViewIsCreated();
141 141
         uut.onViewAppeared();
142 142
 
143 143
         Options opts = new Options();
144
-        opts.topBarOptions.title.text = new Text("the title");
145
-        opts.topBarOptions.title.fontSize = new Fraction(18);
144
+        opts.topBar.title.text = new Text("the title");
145
+        opts.topBar.title.fontSize = new Fraction(18);
146 146
         uut.mergeOptions(opts);
147 147
 
148 148
         assertThat(stackController.getTopBar().getTitleTextView()).isNotEqualTo(null);
@@ -152,14 +152,14 @@ public class OptionsApplyingTest extends BaseTest {
152 152
     @Test
153 153
     public void appliesTopBarVisible() {
154 154
         assertThat(uut.initialOptions).isSameAs(initialNavigationOptions);
155
-        initialNavigationOptions.topBarOptions.title.text = new Text("the title");
155
+        initialNavigationOptions.topBar.title.text = new Text("the title");
156 156
         uut.ensureViewIsCreated();
157 157
         uut.onViewAppeared();
158 158
         assertThat(stackController.getTopBar().getVisibility()).isNotEqualTo(View.GONE);
159 159
 
160 160
         Options opts = new Options();
161
-        opts.topBarOptions.visible = new Bool(false);
162
-        opts.topBarOptions.animate = new Bool(false);
161
+        opts.topBar.visible = new Bool(false);
162
+        opts.topBar.animate = new Bool(false);
163 163
         uut.mergeOptions(opts);
164 164
 
165 165
         assertThat(stackController.getTopBar().getVisibility()).isEqualTo(View.GONE);
@@ -167,8 +167,8 @@ public class OptionsApplyingTest extends BaseTest {
167 167
 
168 168
     @Test
169 169
     public void appliesDrawUnder() {
170
-        uut.options.topBarOptions.title.text = new Text("the title");
171
-        uut.options.topBarOptions.drawBehind = new Bool(false);
170
+        uut.options.topBar.title.text = new Text("the title");
171
+        uut.options.topBar.drawBehind = new Bool(false);
172 172
         uut.ensureViewIsCreated();
173 173
         stackController.ensureViewIsCreated();
174 174
         stackController.push(uut, new CommandListenerAdapter() {
@@ -179,7 +179,7 @@ public class OptionsApplyingTest extends BaseTest {
179 179
                 assertThat(uutLayoutParams.topMargin).isNotEqualTo(0);
180 180
 
181 181
                 Options opts = new Options();
182
-                opts.topBarOptions.drawBehind = new Bool(true);
182
+                opts.topBar.drawBehind = new Bool(true);
183 183
                 uut.mergeOptions(opts);
184 184
 
185 185
                 uutLayoutParams = (RelativeLayout.LayoutParams) (uut.getComponent().asView()).getLayoutParams();
@@ -192,7 +192,7 @@ public class OptionsApplyingTest extends BaseTest {
192 192
     public void appliesTopBarComponent() throws Exception {
193 193
         JSONObject json = new JSONObject();
194 194
         json.put("component", new JSONObject().put("name","someComponent").put("componentId", "id"));
195
-        uut.options.topBarOptions.background = TopBarBackgroundOptions.parse(json);
195
+        uut.options.topBar.background = TopBarBackgroundOptions.parse(json);
196 196
         uut.ensureViewIsCreated();
197 197
         stackController.push(uut, new CommandListenerAdapter());
198 198
         uut.onViewAppeared();
@@ -205,7 +205,7 @@ public class OptionsApplyingTest extends BaseTest {
205 205
     public void appliesSubtitle() throws Exception {
206 206
         JSONObject json = new JSONObject();
207 207
         json.put("text", "sub");
208
-        uut.options.topBarOptions.subtitle = SubtitleOptions.parse(new TypefaceLoaderMock(), json);
208
+        uut.options.topBar.subtitle = SubtitleOptions.parse(new TypefaceLoaderMock(), json);
209 209
         uut.ensureViewIsCreated();
210 210
         stackController.push(uut, new CommandListenerAdapter());
211 211
         uut.onViewAppeared();

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

@@ -67,11 +67,11 @@ public class OptionsMergingTest extends BaseTest {
67 67
         verify(topBar, times(0)).setRightButtons(any());
68 68
         verify(topBar, times(0)).setLeftButtons(any());
69 69
 
70
-        options.topBarOptions.rightButtons = new ArrayList<>();
70
+        options.topBar.rightButtons = new ArrayList<>();
71 71
         uut.mergeChildOptions(options, child);
72 72
         verify(topBar, times(1)).setRightButtons(any());
73 73
 
74
-        options.topBarOptions.leftButtons = new ArrayList<>();
74
+        options.topBar.leftButtons = new ArrayList<>();
75 75
         uut.mergeChildOptions(options, child);
76 76
         verify(topBar, times(1)).setLeftButtons(any());
77 77
     }
@@ -89,22 +89,22 @@ public class OptionsMergingTest extends BaseTest {
89 89
         titleOptions.color = new Color(0);
90 90
         titleOptions.fontSize = new Fraction(1.0f);
91 91
         titleOptions.fontFamily = Typeface.DEFAULT_BOLD;
92
-        options.topBarOptions.title = titleOptions;
92
+        options.topBar.title = titleOptions;
93 93
         SubtitleOptions subtitleOptions = new SubtitleOptions();
94 94
         subtitleOptions.text = new Text("Sub");
95 95
         subtitleOptions.color = new Color(1);
96
-        options.topBarOptions.subtitle = subtitleOptions;
97
-        options.topBarOptions.background.color = new Color(0);
98
-        options.topBarOptions.testId = new Text("test123");
99
-        options.topBarOptions.animate = new Bool(false);
100
-        options.topBarOptions.visible = new Bool(false);
101
-        options.topBarOptions.drawBehind = new Bool(false);
102
-        options.topBarOptions.hideOnScroll = new Bool(false);
96
+        options.topBar.subtitle = subtitleOptions;
97
+        options.topBar.background.color = new Color(0);
98
+        options.topBar.testId = new Text("test123");
99
+        options.topBar.animate = new Bool(false);
100
+        options.topBar.visible = new Bool(false);
101
+        options.topBar.drawBehind = new Bool(false);
102
+        options.topBar.hideOnScroll = new Bool(false);
103 103
         uut.mergeChildOptions(options, child);
104 104
 
105 105
         assertTopBarOptions(1);
106 106
 
107
-        options.topBarOptions.drawBehind = new Bool(true);
107
+        options.topBar.drawBehind = new Bool(true);
108 108
         uut.mergeChildOptions(options, child);
109 109
         verify(child, times(1)).drawBehindTopBar();
110 110
     }

+ 5
- 5
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/ParentControllerTest.java View File

@@ -42,7 +42,7 @@ public class ParentControllerTest extends BaseTest {
42 42
         activity = newActivity();
43 43
         children = new ArrayList<>();
44 44
         Options initialOptions = new Options();
45
-        initialOptions.topBarOptions.title.text = new Text(INITIAL_TITLE);
45
+        initialOptions.topBar.title.text = new Text(INITIAL_TITLE);
46 46
         uut = spy(new ParentController(activity, "uut", initialOptions) {
47 47
 
48 48
             @NonNull
@@ -125,7 +125,7 @@ public class ParentControllerTest extends BaseTest {
125 125
     @Test
126 126
     public void mergeOptions_optionsAreMergedWhenChildAppears() {
127 127
         Options options = new Options();
128
-        options.topBarOptions.title.text = new Text("new title");
128
+        options.topBar.title.text = new Text("new title");
129 129
         ViewController child1 = spy(new SimpleViewController(activity, "child1", options));
130 130
         children.add(child1);
131 131
         uut.ensureViewIsCreated();
@@ -136,14 +136,14 @@ public class ParentControllerTest extends BaseTest {
136 136
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
137 137
         verify(uut, times(1)).clearOptions();
138 138
         verify(uut, times(1)).applyChildOptions(optionsCaptor.capture(), viewCaptor.capture());
139
-        assertThat(optionsCaptor.getValue().topBarOptions.title.text.get()).isEqualTo("new title");
139
+        assertThat(optionsCaptor.getValue().topBar.title.text.get()).isEqualTo("new title");
140 140
         assertThat(viewCaptor.getValue()).isEqualTo(child1.getView());
141 141
     }
142 142
 
143 143
     @Test
144 144
     public void mergeOptions_initialParentOptionsAreNotMutatedWhenChildAppears() {
145 145
         Options options = new Options();
146
-        options.topBarOptions.title.text = new Text("new title");
146
+        options.topBar.title.text = new Text("new title");
147 147
         ViewController child1 = spy(new SimpleViewController(activity, "child1", options));
148 148
         children.add(child1);
149 149
 
@@ -151,7 +151,7 @@ public class ParentControllerTest extends BaseTest {
151 151
 
152 152
         child1.ensureViewIsCreated();
153 153
         child1.onViewAppeared();
154
-        assertThat(uut.initialOptions.topBarOptions.title.text.get()).isEqualTo(INITIAL_TITLE);
154
+        assertThat(uut.initialOptions.topBar.title.text.get()).isEqualTo(INITIAL_TITLE);
155 155
     }
156 156
 
157 157
     private StackController createStack() {

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

@@ -155,7 +155,7 @@ public class StackControllerTest extends BaseTest {
155 155
                 uut.pop(new CommandListenerAdapter() {
156 156
                     @Override
157 157
                     public void onSuccess(String childId) {
158
-                        verify(stackLayout[0], times(1)).onChildWillDisappear(child2.options, child1.options);
158
+                        verify(stackLayout[0], times(1)).onChildWillPop(child2.options, child1.options);
159 159
                     }
160 160
                 });
161 161
             }
@@ -254,10 +254,9 @@ public class StackControllerTest extends BaseTest {
254 254
         uut.ensureViewIsCreated();
255 255
         child1.ensureViewIsCreated();
256 256
 
257
-        child1.options.topBarOptions.visible = new Bool(false);
258
-        child1.options.topBarOptions.animate = new Bool(false);
259
-        child1.options.animated = new Bool(false);
260
-        child2.options.animated = new Bool(false);
257
+        child1.options.topBar.visible = new Bool(false);
258
+        child1.options.topBar.animate = new Bool(false);
259
+        disablePushAnimation(child1, child2);
261 260
 
262 261
         uut.push(child1, new CommandListenerAdapter() {
263 262
             @Override
@@ -267,7 +266,7 @@ public class StackControllerTest extends BaseTest {
267 266
 
268 267
                 uut.push(child2, new CommandListenerAdapter());
269 268
                 child2.onViewAppeared();
270
-                verify(uut.getTopBar(), times(0)).showAnimate(child2.options.animationsOptions.push.topBar);
269
+                verify(uut.getTopBar(), times(0)).showAnimate(child2.options.animations.push.topBar);
271 270
                 assertThat(uut.getTopBar().getVisibility()).isEqualTo(View.VISIBLE);
272 271
                 verify(uut.getTopBar(), times(1)).resetAnimationOptions();
273 272
             }
@@ -278,9 +277,9 @@ public class StackControllerTest extends BaseTest {
278 277
     public void push_animatesAndClearsPreviousAnimationValues() {
279 278
         uut.ensureViewIsCreated();
280 279
 
281
-        child1.options.topBarOptions.visible = new Bool(false);
282
-        child1.options.topBarOptions.animate = new Bool(false);
283
-        child1.options.animated = new Bool(false);
280
+        child1.options.topBar.visible = new Bool(false);
281
+        child1.options.topBar.animate = new Bool(false);
282
+        child1.options.animations.push.enabled = new Bool(false);
284 283
 
285 284
         uut.push(child1, new CommandListenerAdapter());
286 285
         uut.push(child2, new CommandListenerAdapter() {
@@ -385,8 +384,8 @@ public class StackControllerTest extends BaseTest {
385 384
 
386 385
     @Test
387 386
     public void popToRoot_PopsEverythingAboveFirstController() {
388
-        child1.options.animated = new Bool(false);
389
-        child2.options.animated = new Bool(false);
387
+        child1.options.animations.push.enabled = new Bool(false);
388
+        child2.options.animations.push.enabled = new Bool(false);
390 389
 
391 390
         uut.push(child1, new CommandListenerAdapter());
392 391
         uut.push(child2, new CommandListenerAdapter());
@@ -409,16 +408,14 @@ public class StackControllerTest extends BaseTest {
409 408
 
410 409
     @Test
411 410
     public void popToRoot_onlyTopChildIsAnimated() {
412
-        child1.options.animated = new Bool(false);
413
-        child2.options.animated = new Bool(false);
411
+        child1.options.animations.push.enabled = new Bool(false);
412
+        child2.options.animations.push.enabled = new Bool(false);
414 413
 
415 414
         uut.push(child1, new CommandListenerAdapter());
416 415
         uut.push(child2, new CommandListenerAdapter());
417 416
         uut.push(child3, new CommandListenerAdapter() {
418 417
             @Override
419 418
             public void onSuccess(String childId) {
420
-                child1.options.animated = new Bool(true);
421
-                child2.options.animated = new Bool(true);
422 419
                 uut.popToRoot(new CommandListenerAdapter() {
423 420
                     @Override
424 421
                     public void onSuccess(String childId) {
@@ -431,9 +428,9 @@ public class StackControllerTest extends BaseTest {
431 428
 
432 429
     @Test
433 430
     public void popToRoot_topChildrenAreDestroyed() {
434
-        child1.options.animated = new Bool(false);
435
-        child2.options.animated = new Bool(false);
436
-        child3.options.animated = new Bool(false);
431
+        child1.options.animations.push.enabled = new Bool(false);
432
+        child2.options.animations.push.enabled = new Bool(false);
433
+        child3.options.animations.push.enabled = new Bool(false);
437 434
 
438 435
         uut.push(child1, new CommandListenerAdapter());
439 436
         uut.push(child2, new CommandListenerAdapter());
@@ -493,8 +490,8 @@ public class StackControllerTest extends BaseTest {
493 490
 
494 491
     @Test
495 492
     public void pop_callWillAppearWillDisappear() {
496
-        child1.options.animated = new Bool(false);
497
-        child2.options.animated = new Bool(false);
493
+        child1.options.animations.push.enabled = new Bool(false);
494
+        child2.options.animations.push.enabled = new Bool(false);
498 495
         child1 = spy(child1);
499 496
         child2 = spy(child2);
500 497
         uut.push(child1, new CommandListenerAdapter());
@@ -508,9 +505,9 @@ public class StackControllerTest extends BaseTest {
508 505
     public void pop_animatesTopBar() {
509 506
         uut.ensureViewIsCreated();
510 507
 
511
-        child1.options.topBarOptions.visible = new Bool(false);
512
-        child1.options.animated = new Bool(false);
513
-        child2.options.animated = new Bool(true);
508
+        child1.options.topBar.visible = new Bool(false);
509
+        child1.options.animations.push.enabled = new Bool(false);
510
+        child2.options.animations.push.enabled = new Bool(true);
514 511
         uut.push(child1, new CommandListenerAdapter() {
515 512
             @Override
516 513
             public void onSuccess(String childId) {
@@ -522,7 +519,7 @@ public class StackControllerTest extends BaseTest {
522 519
                         uut.pop(new CommandListenerAdapter() {
523 520
                             @Override
524 521
                             public void onSuccess(String childId) {
525
-                                verify(uut.getTopBar(), times(1)).hideAnimate(child2.options.animationsOptions.pop.topBar);
522
+                                verify(uut.getTopBar(), times(1)).hideAnimate(child2.options.animations.pop.topBar);
526 523
                             }
527 524
                         });
528 525
                     }
@@ -535,8 +532,11 @@ public class StackControllerTest extends BaseTest {
535 532
     public void pop_doesNotAnimateTopBarIfScreenIsPushedWithoutAnimation() {
536 533
         uut.ensureViewIsCreated();
537 534
 
538
-        child1.options.topBarOptions.visible = new Bool(false);
539
-        child2.options.animated = new Bool(false);
535
+        child1.options.topBar.visible = new Bool(false);
536
+        child1.options.topBar.animate = new Bool(false);
537
+        child2.options.animations.push.enabled = new Bool(false);
538
+        child2.options.topBar.animate = new Bool(false);
539
+
540 540
         child1.ensureViewIsCreated();
541 541
         uut.push(child1, new CommandListenerAdapter() {
542 542
             @Override
@@ -545,7 +545,7 @@ public class StackControllerTest extends BaseTest {
545 545
                 assertThat(uut.getTopBar().getVisibility()).isEqualTo(View.VISIBLE);
546 546
 
547 547
                 uut.pop(new CommandListenerAdapter());
548
-                verify(uut.getTopBar(), times(0)).hideAnimate(child2.options.animationsOptions.pop.topBar);
548
+                verify(uut.getTopBar(), times(0)).hideAnimate(child2.options.animations.pop.topBar);
549 549
                 assertThat(uut.getTopBar().getVisibility()).isEqualTo(View.GONE);
550 550
             }
551 551
         });
@@ -605,7 +605,7 @@ public class StackControllerTest extends BaseTest {
605 605
         parent.push(uut, new CommandListenerAdapter());
606 606
 
607 607
         Options childOptions = new Options();
608
-        childOptions.topBarOptions.title.text = new Text("Something");
608
+        childOptions.topBar.title.text = new Text("Something");
609 609
         child1.options = childOptions;
610 610
         uut.push(child1, new CommandListenerAdapter());
611 611
         child1.ensureViewIsCreated();
@@ -614,7 +614,7 @@ public class StackControllerTest extends BaseTest {
614 614
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
615 615
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
616 616
         verify(parent, times(1)).applyChildOptions(optionsCaptor.capture(), viewCaptor.capture());
617
-        assertThat(optionsCaptor.getValue().topBarOptions.title.text.hasValue()).isFalse();
617
+        assertThat(optionsCaptor.getValue().topBar.title.text.hasValue()).isFalse();
618 618
     }
619 619
 
620 620
     @Test
@@ -667,14 +667,14 @@ public class StackControllerTest extends BaseTest {
667 667
         ParentController parentController = Mockito.mock(ParentController.class);
668 668
         uut.setParentController(parentController);
669 669
         Options optionsToMerge = new Options();
670
-        optionsToMerge.topBarOptions.testId = new Text("topBarID");
670
+        optionsToMerge.topBar.testId = new Text("topBarID");
671 671
         optionsToMerge.bottomTabsOptions.testId = new Text("bottomTabsID");
672 672
         Component component = mock(Component.class);
673 673
         uut.mergeChildOptions(optionsToMerge, component);
674 674
 
675 675
         ArgumentCaptor<Options> captor = ArgumentCaptor.forClass(Options.class);
676 676
         verify(parentController, times(1)).mergeChildOptions(captor.capture(), eq(component));
677
-        assertThat(captor.getValue().topBarOptions.testId.hasValue()).isFalse();
677
+        assertThat(captor.getValue().topBar.testId.hasValue()).isFalse();
678 678
         assertThat(captor.getValue().bottomTabsOptions.testId.get()).isEqualTo(optionsToMerge.bottomTabsOptions.testId.get());
679 679
     }
680 680
 
@@ -684,8 +684,8 @@ public class StackControllerTest extends BaseTest {
684 684
         Component component = mock(Component.class);
685 685
 
686 686
         uut.mergeChildOptions(options, component);
687
-        verify(animator, times(0)).setOptions(options.animationsOptions);
688
-        verify(animator, times(1)).mergeOptions(options.animationsOptions);
687
+        verify(animator, times(0)).setOptions(options.animations);
688
+        verify(animator, times(1)).mergeOptions(options.animations);
689 689
     }
690 690
 
691 691
     @Test
@@ -693,8 +693,8 @@ public class StackControllerTest extends BaseTest {
693 693
         ParentController parentController = Mockito.mock(ParentController.class);
694 694
         uut.setParentController(parentController);
695 695
         Options options = new Options();
696
-        options.animationsOptions.push = NestedAnimationsOptions.parse(new JSONObject());
697
-        options.topBarOptions.testId = new Text("id");
696
+        options.animations.push = NestedAnimationsOptions.parse(new JSONObject());
697
+        options.topBar.testId = new Text("id");
698 698
         options.fabOptions.id = new Text("fabId");
699 699
         Component component = mock(Component.class);
700 700
 
@@ -702,8 +702,8 @@ public class StackControllerTest extends BaseTest {
702 702
         uut.mergeChildOptions(options, component);
703 703
         ArgumentCaptor<Options> captor = ArgumentCaptor.forClass(Options.class);
704 704
         verify(parentController, times(1)).mergeChildOptions(captor.capture(), eq(component));
705
-        assertThat(captor.getValue().animationsOptions.push.hasValue()).isFalse();
706
-        assertThat(captor.getValue().topBarOptions.testId.hasValue()).isFalse();
705
+        assertThat(captor.getValue().animations.push.hasValue()).isFalse();
706
+        assertThat(captor.getValue().topBar.testId.hasValue()).isFalse();
707 707
         assertThat(captor.getValue().fabOptions.hasValue()).isFalse();
708 708
     }
709 709
 

+ 6
- 6
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopTabsViewControllerTest.java View File

@@ -79,7 +79,7 @@ public class TopTabsViewControllerTest extends BaseTest {
79 79
         for (int i = 0; i < SIZE; i++) {
80 80
             final Options options = new Options();
81 81
             options.topTabOptions.title = new Text("Tab " + i);
82
-            options.topBarOptions.title.text = new Text(createTabTopBarTitle(i));
82
+            options.topBar.title.text = new Text(createTabTopBarTitle(i));
83 83
             result.add(options);
84 84
         }
85 85
         return result;
@@ -181,17 +181,17 @@ public class TopTabsViewControllerTest extends BaseTest {
181 181
         uut.onViewAppeared();
182 182
         ReactComponent currentTab = tabView(0);
183 183
         verify(uut, times(1)).applyChildOptions(any(Options.class), eq(currentTab));
184
-        assertThat(uut.options.topBarOptions.title.text.get()).isEqualTo(createTabTopBarTitle(0));
184
+        assertThat(uut.options.topBar.title.text.get()).isEqualTo(createTabTopBarTitle(0));
185 185
 
186 186
         uut.switchToTab(1);
187 187
         currentTab = tabView(1);
188 188
         verify(uut, times(1)).applyChildOptions(any(Options.class), eq(currentTab));
189
-        assertThat(uut.options.topBarOptions.title.text.get()).isEqualTo(createTabTopBarTitle(1));
189
+        assertThat(uut.options.topBar.title.text.get()).isEqualTo(createTabTopBarTitle(1));
190 190
 
191 191
         uut.switchToTab(0);
192 192
         currentTab = tabView(0);
193 193
         verify(uut, times(2)).applyChildOptions(any(Options.class), eq(currentTab));
194
-        assertThat(uut.options.topBarOptions.title.text.get()).isEqualTo(createTabTopBarTitle(0));
194
+        assertThat(uut.options.topBar.title.text.get()).isEqualTo(createTabTopBarTitle(0));
195 195
     }
196 196
 
197 197
     private TestReactView getActualTabView(int index) {
@@ -231,8 +231,8 @@ public class TopTabsViewControllerTest extends BaseTest {
231 231
                 new TestComponentViewCreator(),
232 232
                 new Options()
233 233
         );
234
-        first.options.animated = new Bool(false);
235
-        uut.options.animated = new Bool(false);
234
+        first.options.animations.push.enabled = new Bool(false);
235
+        uut.options.animations.push.enabled = new Bool(false);
236 236
         stackController.push(first, new CommandListenerAdapter());
237 237
         stackController.push(uut, new CommandListenerAdapter());
238 238