Quellcode durchsuchen

Rename enabled to enable in animation options

Guy Carmeli vor 6 Jahren
Ursprung
Commit
85e321ad18

+ 5
- 3
lib/android/app/src/main/java/com/reactnativenavigation/parse/NestedAnimationsOptions.java Datei anzeigen

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

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/presentation/OptionsPresenter.java Datei anzeigen

@@ -62,14 +62,14 @@ public class OptionsPresenter {
62 62
         if (options.testId.hasValue()) topBar.setTestId(options.testId.get());
63 63
 
64 64
         if (options.visible.isFalse()) {
65
-            if (options.animate.isTrueOrUndefined() && componentOptions.animations.push.enabled.isTrueOrUndefined()) {
65
+            if (options.animate.isTrueOrUndefined() && componentOptions.animations.push.enable.isTrueOrUndefined()) {
66 66
                 topBar.hideAnimate(animationOptions.pop.topBar);
67 67
             } else {
68 68
                 topBar.hide();
69 69
             }
70 70
         }
71 71
         if (options.visible.isTrueOrUndefined()) {
72
-            if (options.animate.isTrueOrUndefined() && componentOptions.animations.push.enabled.isTrueOrUndefined()) {
72
+            if (options.animate.isTrueOrUndefined() && componentOptions.animations.push.enable.isTrueOrUndefined()) {
73 73
                 topBar.showAnimate(animationOptions.push.topBar);
74 74
             } else {
75 75
                 topBar.show();
@@ -106,7 +106,7 @@ public class OptionsPresenter {
106 106
 
107 107
     public void onChildWillPop(Options disappearing, Options appearing) {
108 108
         if (disappearing.topBar.visible.isTrueOrUndefined() && appearing.topBar.visible.isFalse()) {
109
-            if (disappearing.topBar.animate.isTrueOrUndefined() && disappearing.animations.pop.enabled.isTrueOrUndefined()) {
109
+            if (disappearing.topBar.animate.isTrueOrUndefined() && disappearing.animations.pop.enable.isTrueOrUndefined()) {
110 110
                 topBar.hideAnimate(disappearing.animations.pop.topBar);
111 111
             } else {
112 112
                 topBar.hide();

+ 2
- 2
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/StackController.java Datei anzeigen

@@ -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.animations.push.enabled.isTrueOrUndefined()) {
99
+            if (child.options.animations.push.enable.isTrueOrUndefined()) {
100 100
                 animator.push(child.getView(), () -> {
101 101
                     getView().removeView(toRemove.getView());
102 102
                     listener.onSuccess(child.getId());
@@ -143,7 +143,7 @@ public class StackController extends ParentController<StackLayout> {
143 143
         getView().addView(appearing.getView(), 0);
144 144
         getView().onChildWillPop(disappearing.options, appearing.options);
145 145
 
146
-        if (disappearing.options.animations.pop.enabled.isTrueOrUndefined()) {
146
+        if (disappearing.options.animations.pop.enable.isTrueOrUndefined()) {
147 147
             animator.pop(disappearing.getView(), () -> finishPopping(disappearing, listener));
148 148
         } else {
149 149
             finishPopping(disappearing, listener);

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/BaseTest.java Datei anzeigen

@@ -47,7 +47,7 @@ public abstract class BaseTest {
47 47
 
48 48
     protected void disablePushAnimation(ViewController... controllers) {
49 49
         for (ViewController controller : controllers) {
50
-            controller.options.animations.push.enabled = new Bool(false);
50
+            controller.options.animations.push.enable = new Bool(false);
51 51
         }
52 52
     }
53 53
 }

+ 2
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/NavigatorTest.java Datei anzeigen

@@ -346,8 +346,8 @@ public class NavigatorTest extends BaseTest {
346 346
 
347 347
     @Test
348 348
     public void pushedStackCanBePopped() {
349
-        child1.options.animations.push.enabled = new Bool(false);
350
-        child2.options.animations.push.enabled = new Bool(false);
349
+        child1.options.animations.push.enable = new Bool(false);
350
+        child2.options.animations.push.enable = new Bool(false);
351 351
         StackController parent = newStack();
352 352
         parent.ensureViewIsCreated();
353 353
         uut.setRoot(parent, new MockPromise());

+ 13
- 13
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/StackControllerTest.java Datei anzeigen

@@ -279,7 +279,7 @@ public class StackControllerTest extends BaseTest {
279 279
 
280 280
         child1.options.topBar.visible = new Bool(false);
281 281
         child1.options.topBar.animate = new Bool(false);
282
-        child1.options.animations.push.enabled = new Bool(false);
282
+        child1.options.animations.push.enable = new Bool(false);
283 283
 
284 284
         uut.push(child1, new CommandListenerAdapter());
285 285
         uut.push(child2, new CommandListenerAdapter() {
@@ -384,8 +384,8 @@ public class StackControllerTest extends BaseTest {
384 384
 
385 385
     @Test
386 386
     public void popToRoot_PopsEverythingAboveFirstController() {
387
-        child1.options.animations.push.enabled = new Bool(false);
388
-        child2.options.animations.push.enabled = new Bool(false);
387
+        child1.options.animations.push.enable = new Bool(false);
388
+        child2.options.animations.push.enable = new Bool(false);
389 389
 
390 390
         uut.push(child1, new CommandListenerAdapter());
391 391
         uut.push(child2, new CommandListenerAdapter());
@@ -408,8 +408,8 @@ public class StackControllerTest extends BaseTest {
408 408
 
409 409
     @Test
410 410
     public void popToRoot_onlyTopChildIsAnimated() {
411
-        child1.options.animations.push.enabled = new Bool(false);
412
-        child2.options.animations.push.enabled = new Bool(false);
411
+        child1.options.animations.push.enable = new Bool(false);
412
+        child2.options.animations.push.enable = new Bool(false);
413 413
 
414 414
         uut.push(child1, new CommandListenerAdapter());
415 415
         uut.push(child2, new CommandListenerAdapter());
@@ -428,9 +428,9 @@ public class StackControllerTest extends BaseTest {
428 428
 
429 429
     @Test
430 430
     public void popToRoot_topChildrenAreDestroyed() {
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);
431
+        child1.options.animations.push.enable = new Bool(false);
432
+        child2.options.animations.push.enable = new Bool(false);
433
+        child3.options.animations.push.enable = new Bool(false);
434 434
 
435 435
         uut.push(child1, new CommandListenerAdapter());
436 436
         uut.push(child2, new CommandListenerAdapter());
@@ -490,8 +490,8 @@ public class StackControllerTest extends BaseTest {
490 490
 
491 491
     @Test
492 492
     public void pop_callWillAppearWillDisappear() {
493
-        child1.options.animations.push.enabled = new Bool(false);
494
-        child2.options.animations.push.enabled = new Bool(false);
493
+        child1.options.animations.push.enable = new Bool(false);
494
+        child2.options.animations.push.enable = new Bool(false);
495 495
         child1 = spy(child1);
496 496
         child2 = spy(child2);
497 497
         uut.push(child1, new CommandListenerAdapter());
@@ -506,8 +506,8 @@ public class StackControllerTest extends BaseTest {
506 506
         uut.ensureViewIsCreated();
507 507
 
508 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);
509
+        child1.options.animations.push.enable = new Bool(false);
510
+        child2.options.animations.push.enable = new Bool(true);
511 511
         uut.push(child1, new CommandListenerAdapter() {
512 512
             @Override
513 513
             public void onSuccess(String childId) {
@@ -534,7 +534,7 @@ public class StackControllerTest extends BaseTest {
534 534
 
535 535
         child1.options.topBar.visible = new Bool(false);
536 536
         child1.options.topBar.animate = new Bool(false);
537
-        child2.options.animations.push.enabled = new Bool(false);
537
+        child2.options.animations.push.enable = new Bool(false);
538 538
         child2.options.topBar.animate = new Bool(false);
539 539
 
540 540
         child1.ensureViewIsCreated();

+ 2
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopTabsViewControllerTest.java Datei anzeigen

@@ -231,8 +231,8 @@ public class TopTabsViewControllerTest extends BaseTest {
231 231
                 new TestComponentViewCreator(),
232 232
                 new Options()
233 233
         );
234
-        first.options.animations.push.enabled = new Bool(false);
235
-        uut.options.animations.push.enabled = new Bool(false);
234
+        first.options.animations.push.enable = new Bool(false);
235
+        uut.options.animations.push.enable = new Bool(false);
236 236
         stackController.push(first, new CommandListenerAdapter());
237 237
         stackController.push(uut, new CommandListenerAdapter());
238 238