Procházet zdrojové kódy

Rename applyOptions(Options, Component) to applyChildOpions

Guy Carmeli před 6 roky
rodič
revize
7206280b92

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ComponentViewController.java Zobrazit soubor

@@ -62,7 +62,7 @@ public class ComponentViewController extends ViewController<ComponentLayout> imp
62 62
     public void mergeOptions(Options options) {
63 63
         this.options = this.options.mergeWith(options);
64 64
         view.applyOptions(this.options);
65
-        applyOnParentController(parentController -> parentController.applyOptions(this.options, view));
65
+        applyOnParentController(parentController -> parentController.applyChildOptions(this.options, view));
66 66
     }
67 67
 
68 68
     ReactComponent getComponent() {

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ParentController.java Zobrazit soubor

@@ -57,7 +57,7 @@ public abstract class ParentController<T extends ViewGroup> extends ViewControll
57 57
     }
58 58
 
59 59
     @CallSuper
60
-    public void applyOptions(Options options, Component childComponent) {
60
+    public void applyChildOptions(Options options, Component child) {
61 61
         mergeChildOptions(options);
62 62
     }
63 63
 

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/SideMenuController.java Zobrazit soubor

@@ -49,10 +49,10 @@ public class SideMenuController extends ParentController<DrawerLayout> implement
49 49
 	}
50 50
 
51 51
     @Override
52
-    public void applyOptions(Options options, Component childComponent) {
53
-        super.applyOptions(options, childComponent);
52
+    public void applyChildOptions(Options options, Component child) {
53
+        super.applyChildOptions(options, child);
54 54
         applyOnParentController(parentController ->
55
-                ((ParentController) parentController).applyOptions(this.options, childComponent)
55
+                ((ParentController) parentController).applyChildOptions(this.options, child)
56 56
         );
57 57
     }
58 58
 

+ 6
- 6
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/StackController.java Zobrazit soubor

@@ -42,14 +42,14 @@ public class StackController extends ParentController <StackLayout> {
42 42
     }
43 43
 
44 44
     @Override
45
-    public void applyOptions(Options options, Component component) {
46
-        super.applyOptions(options, component);
47
-        getView().applyOptions(this.options, component);
45
+    public void applyChildOptions(Options options, Component child) {
46
+        super.applyChildOptions(options, child);
47
+        getView().applyOptions(this.options, child);
48 48
         applyOnParentController(parentController ->
49
-                ((ParentController) parentController).applyOptions(this.options.copy().clearTopBarOptions(), component)
49
+                ((ParentController) parentController).applyChildOptions(this.options.copy().clearTopBarOptions(), child)
50 50
         );
51
-        if (component instanceof ReactComponent) {
52
-            fabOptionsPresenter.applyOptions(options.fabOptions, (ReactComponent) component, getView());
51
+        if (child instanceof ReactComponent) {
52
+            fabOptionsPresenter.applyOptions(options.fabOptions, (ReactComponent) child, getView());
53 53
         }
54 54
         animator.setOptions(options.animationsOptions);
55 55
     }

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/ViewController.java Zobrazit soubor

@@ -156,7 +156,7 @@ public abstract class ViewController<T extends ViewGroup> implements ViewTreeObs
156 156
         applyOptions(options);
157 157
         applyOnParentController(parentController -> {
158 158
             parentController.clearOptions();
159
-            if (getView() instanceof Component) parentController.applyOptions(options, (Component) getView());
159
+            if (getView() instanceof Component) parentController.applyChildOptions(options, (Component) getView());
160 160
         });
161 161
     }
162 162
 

+ 4
- 4
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java Zobrazit soubor

@@ -57,12 +57,12 @@ public class BottomTabsController extends ParentController implements AHBottomNa
57 57
     }
58 58
 
59 59
     @Override
60
-    public void applyOptions(Options options, Component childComponent) {
61
-        super.applyOptions(options, childComponent);
62
-        int tabIndex = bottomTabFinder.findByComponent(childComponent);
60
+    public void applyChildOptions(Options options, Component child) {
61
+        super.applyChildOptions(options, child);
62
+        int tabIndex = bottomTabFinder.findByComponent(child);
63 63
         if (tabIndex >= 0) new BottomTabsOptionsPresenter(bottomTabs, bottomTabFinder).present(this.options, tabIndex);
64 64
         applyOnParentController(parentController ->
65
-                ((ParentController) parentController).applyOptions(this.options.copy().clearBottomTabsOptions().clearBottomTabOptions(), childComponent)
65
+                ((ParentController) parentController).applyChildOptions(this.options.copy().clearBottomTabsOptions().clearBottomTabOptions(), child)
66 66
         );
67 67
     }
68 68
 

+ 3
- 3
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsController.java Zobrazit soubor

@@ -79,11 +79,11 @@ public class TopTabsController extends ParentController<TopTabsViewPager> implem
79 79
     }
80 80
 
81 81
     @Override
82
-    public void applyOptions(Options options, Component childComponent) {
83
-        super.applyOptions(options, childComponent);
82
+    public void applyChildOptions(Options options, Component child) {
83
+        super.applyChildOptions(options, child);
84 84
         applyOnParentController(parentController -> {
85 85
                 Options opt = this.options.copy();
86
-                ((ParentController) parentController).applyOptions(opt.clearTopTabOptions().clearTopTabsOptions(), childComponent);
86
+                ((ParentController) parentController).applyChildOptions(opt.clearTopTabOptions().clearTopTabsOptions(), child);
87 87
             }
88 88
         );
89 89
     }

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/BottomTabsControllerTest.java Zobrazit soubor

@@ -139,7 +139,7 @@ public class BottomTabsControllerTest extends BaseTest {
139 139
         child1.onViewAppeared();
140 140
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
141 141
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
142
-        verify(stack, times(1)).applyOptions(optionsCaptor.capture(), viewCaptor.capture());
142
+        verify(stack, times(1)).applyChildOptions(optionsCaptor.capture(), viewCaptor.capture());
143 143
         assertThat(viewCaptor.getValue()).isEqualTo(child1.getView());
144 144
         assertThat(optionsCaptor.getValue().bottomTabsOptions.tabColor.hasValue()).isFalse();
145 145
     }

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/ParentControllerTest.java Zobrazit soubor

@@ -132,7 +132,7 @@ public class ParentControllerTest extends BaseTest {
132 132
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
133 133
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
134 134
         verify(uut, times(1)).clearOptions();
135
-        verify(uut, times(1)).applyOptions(optionsCaptor.capture(), viewCaptor.capture());
135
+        verify(uut, times(1)).applyChildOptions(optionsCaptor.capture(), viewCaptor.capture());
136 136
         assertThat(optionsCaptor.getValue().topBarOptions.title.text.get()).isEqualTo("new title");
137 137
         assertThat(viewCaptor.getValue()).isEqualTo(child1.getView());
138 138
     }

+ 2
- 2
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/StackControllerTest.java Zobrazit soubor

@@ -88,7 +88,7 @@ public class StackControllerTest extends BaseTest {
88 88
             @Override
89 89
             public void resolve(@Nullable Object value) {
90 90
                 uut.pop(new MockPromise());
91
-                verify(uut, times(1)).applyOptions(uut.options, eq((ReactComponent) child1.getView()));
91
+                verify(uut, times(1)).applyChildOptions(uut.options, eq((ReactComponent) child1.getView()));
92 92
             }
93 93
         });
94 94
     }
@@ -432,7 +432,7 @@ public class StackControllerTest extends BaseTest {
432 432
 
433 433
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
434 434
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
435
-        verify(parent, times(1)).applyOptions(optionsCaptor.capture(), viewCaptor.capture());
435
+        verify(parent, times(1)).applyChildOptions(optionsCaptor.capture(), viewCaptor.capture());
436 436
         assertThat(optionsCaptor.getValue().topBarOptions.title.text.hasValue()).isFalse();
437 437
     }
438 438
 

+ 5
- 5
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/TopTabsViewControllerTest.java Zobrazit soubor

@@ -166,7 +166,7 @@ public class TopTabsViewControllerTest extends BaseTest {
166 166
         verify(tabControllers.get(1), times(0)).onViewAppeared();
167 167
 
168 168
         ReactComponent comp = ((ComponentViewController) tabControllers.get(0)).getComponent();
169
-        verify(uut, times(1)).applyOptions(any(Options.class), eq(comp));
169
+        verify(uut, times(1)).applyChildOptions(any(Options.class), eq(comp));
170 170
     }
171 171
 
172 172
     @Test
@@ -178,17 +178,17 @@ public class TopTabsViewControllerTest extends BaseTest {
178 178
 
179 179
         uut.onViewAppeared();
180 180
         ReactComponent currentTab = tabView(0);
181
-        verify(uut, times(1)).applyOptions(any(Options.class), eq(currentTab));
181
+        verify(uut, times(1)).applyChildOptions(any(Options.class), eq(currentTab));
182 182
         assertThat(uut.options.topBarOptions.title.text.get()).isEqualTo(createTabTopBarTitle(0));
183 183
 
184 184
         uut.switchToTab(1);
185 185
         currentTab = tabView(1);
186
-        verify(uut, times(1)).applyOptions(any(Options.class), eq(currentTab));
186
+        verify(uut, times(1)).applyChildOptions(any(Options.class), eq(currentTab));
187 187
         assertThat(uut.options.topBarOptions.title.text.get()).isEqualTo(createTabTopBarTitle(1));
188 188
 
189 189
         uut.switchToTab(0);
190 190
         currentTab = tabView(0);
191
-        verify(uut, times(2)).applyOptions(any(Options.class), eq(currentTab));
191
+        verify(uut, times(2)).applyChildOptions(any(Options.class), eq(currentTab));
192 192
         assertThat(uut.options.topBarOptions.title.text.get()).isEqualTo(createTabTopBarTitle(0));
193 193
     }
194 194
 
@@ -213,7 +213,7 @@ public class TopTabsViewControllerTest extends BaseTest {
213 213
         tabControllers.get(0).onViewAppeared();
214 214
         ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
215 215
         ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
216
-        verify(parentController, times(1)).applyOptions(optionsCaptor.capture(), viewCaptor.capture());
216
+        verify(parentController, times(1)).applyChildOptions(optionsCaptor.capture(), viewCaptor.capture());
217 217
         assertThat(optionsCaptor.getValue().topTabOptions.title.hasValue()).isFalse();
218 218
     }
219 219