react-native-navigation 7.21.0 → 7.22.0-snapshot.1649
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ReactNativeNavigation.podspec +1 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/NavigationActivity.java +1 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/BackButton.java +5 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/ElementTransitionOptions.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/HardwareBackButtonOptions.kt +2 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/LayoutFactory.java +120 -120
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/ValueAnimationOptions.kt +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/interpolators/SpringInterpolator.kt +16 -16
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/parsers/TypefaceLoader.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/CommandListenerAdapter.java +0 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java +7 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationPackage.kt +27 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationReactInitializer.java +50 -50
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/Events.kt +34 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +81 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalFrameLayout.kt +19 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalHostLayout.kt +78 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalLayoutController.kt +51 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalViewManager.kt +131 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/CoordinatorLayoutUtils.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/OutlineProvider.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReflectionUtils.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/RenderChecker.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/StatusBarUtils.java +0 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/UiUtils.java +5 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ViewParent.kt +0 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ViewUtils.java +4 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabPresenter.java +6 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsAnimator.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/BottomTabsAttacher.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/modes/AttachMode.java +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/modes/OnSwitchToTab.java +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/child/ChildController.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/child/ChildControllersRegistry.java +5 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentPresenterBase.java +3 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewController.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenter.java +6 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalStack.java +18 -18
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/navigator/Navigator.java +12 -12
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/parent/ParentController.java +22 -22
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuController.java +16 -16
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuPresenter.java +4 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/FabPresenter.java +8 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/IdStack.java +14 -14
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +29 -29
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerBuilder.java +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +29 -28
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarAnimator.kt +1 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarBackgroundViewController.java +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarController.kt +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/BackButtonHelper.java +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonPresenter.kt +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonSpan.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/IconResolver.java +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsAdapter.java +5 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsController.java +8 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabsContainer.kt +1 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabsLayout.java +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/PropertyAnimatorCreator.kt +2 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/ReactImageBoundsAnimator.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/ReactImageMatrixAnimator.kt +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/ReactViewRotationAnimator.kt +0 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/toptabs/TopTabsLayoutCreator.java +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/toptabs/TopTabsViewPager.java +6 -6
- package/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +0 -1
- package/lib/android/app/src/test/java/com/reactnativenavigation/BaseTest.java +23 -28
- package/lib/android/app/src/test/java/com/reactnativenavigation/TestUtils.java +4 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentLayout.java +3 -1
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/OptionsTest.java +9 -1
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/TopBarButtonsTest.kt +70 -0
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/parsers/ColorParseTest.java +0 -3
- package/lib/android/app/src/test/java/com/reactnativenavigation/presentation/RenderCheckerTest.java +6 -6
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabPresenterTest.java +3 -4
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsAttacherTest.java +1 -1
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsControllerTest.java +13 -15
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/modes/AttachModeTest.java +5 -5
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/child/ChildControllerTest.java +2 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/child/ChildControllersRegistryTest.java +2 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenterTest.java +4 -4
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalStackTest.java +10 -10
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/NavigatorTest.java +25 -26
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/RootPresenterTest.kt +2 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/parent/ParentControllerTest.java +15 -15
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuControllerTest.java +11 -11
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/BackButtonHelperTest.java +2 -2
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackAnimatorTest.kt +0 -4
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.kt +15 -15
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenterTest.kt +17 -17
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TopBarControllerTest.kt +3 -3
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsViewControllerTest.java +9 -9
- package/lib/dist/Navigation.d.ts +1 -1
- package/lib/dist/Navigation.js +2 -2
- package/lib/dist/NavigationDelegate.d.ts +1 -1
- package/lib/dist/NavigationDelegate.js +2 -2
- package/lib/dist/adapters/TouchablePreview.js +1 -0
- package/lib/dist/commands/Commands.d.ts +1 -1
- package/lib/dist/commands/Commands.js +2 -2
- package/lib/dist/commands/OptionsProcessor.js +12 -6
- package/lib/dist/components/ComponentWrapper.d.ts +1 -1
- package/lib/dist/components/ComponentWrapper.js +2 -2
- package/lib/dist/components/Modal.d.ts +20 -0
- package/lib/dist/components/Modal.js +93 -0
- package/lib/dist/components/Store.d.ts +1 -1
- package/lib/dist/components/Store.js +2 -2
- package/lib/dist/index.d.ts +1 -0
- package/lib/dist/index.js +1 -0
- package/lib/dist/interfaces/Options.d.ts +15 -0
- package/lib/ios/BottomTabPresenter.h +4 -1
- package/lib/ios/BottomTabPresenter.m +11 -3
- package/lib/ios/BottomTabPresenterCreator.m +11 -4
- package/lib/ios/BottomTabsAppearancePresenter.m +29 -4
- package/lib/ios/RNNBackButtonOptions.h +1 -0
- package/lib/ios/RNNBackButtonOptions.m +4 -1
- package/lib/ios/RNNBottomTabOptions.h +2 -0
- package/lib/ios/RNNBottomTabOptions.m +7 -1
- package/lib/ios/RNNBottomTabsController.m +5 -0
- package/lib/ios/RNNDotIndicatorPresenter.m +12 -6
- package/lib/ios/RNNSegmentedControl.h +1 -1
- package/lib/ios/RNNTabBarItemCreator.h +4 -4
- package/lib/ios/RNNTabBarItemCreator.m +17 -7
- package/lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj +8 -24
- package/lib/ios/TabBarItemAppearanceCreator.m +3 -3
- package/lib/ios/TabBarItemIOS15Creator.h +6 -0
- package/lib/ios/TabBarItemIOS15Creator.m +37 -0
- package/lib/ios/TopBarPresenter.m +13 -3
- package/lib/ios/UIViewController+RNNOptions.m +7 -0
- package/lib/src/Navigation.ts +2 -2
- package/lib/src/NavigationDelegate.ts +2 -2
- package/lib/src/adapters/TouchablePreview.tsx +1 -1
- package/lib/src/commands/Commands.ts +2 -2
- package/lib/src/commands/OptionsProcessor.ts +12 -7
- package/lib/src/components/ComponentWrapper.tsx +11 -8
- package/lib/src/components/Modal.tsx +109 -0
- package/lib/src/components/Store.ts +2 -2
- package/lib/src/index.ts +1 -1
- package/lib/src/interfaces/Options.ts +15 -0
- package/package.json +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationPackage.java +0 -41
- package/lib/ios/BottomTabAppearancePresenter.h +0 -6
- package/lib/ios/BottomTabAppearancePresenter.m +0 -12
- package/lib/ios/HMSegmentedControl.h +0 -287
- package/lib/ios/HMSegmentedControl.m +0 -1063
|
@@ -36,7 +36,6 @@ import com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry;
|
|
|
36
36
|
import com.reactnativenavigation.viewcontrollers.component.ComponentViewController;
|
|
37
37
|
import com.reactnativenavigation.viewcontrollers.modal.ModalStack;
|
|
38
38
|
import com.reactnativenavigation.viewcontrollers.overlay.OverlayManager;
|
|
39
|
-
import com.reactnativenavigation.viewcontrollers.parent.ParentController;
|
|
40
39
|
import com.reactnativenavigation.viewcontrollers.stack.StackController;
|
|
41
40
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter;
|
|
42
41
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.RootPresenter;
|
|
@@ -71,10 +70,10 @@ public class NavigatorTest extends BaseTest {
|
|
|
71
70
|
private RootPresenter rootPresenter;
|
|
72
71
|
private StackController parentController;
|
|
73
72
|
private SimpleViewController child1;
|
|
74
|
-
private ViewController child2;
|
|
75
|
-
private ViewController child3;
|
|
76
|
-
private ViewController child4;
|
|
77
|
-
private ViewController child5;
|
|
73
|
+
private ViewController<?> child2;
|
|
74
|
+
private ViewController<?> child3;
|
|
75
|
+
private ViewController<?> child4;
|
|
76
|
+
private ViewController<?> child5;
|
|
78
77
|
private final Options tabOptions = OptionHelper.createBottomTabOptions();
|
|
79
78
|
private ImageLoader imageLoaderMock;
|
|
80
79
|
private ActivityController<TestActivity> activityController;
|
|
@@ -100,7 +99,7 @@ public class NavigatorTest extends BaseTest {
|
|
|
100
99
|
uut = new Navigator(activity, childRegistry, modalStack, overlayManager, rootPresenter);
|
|
101
100
|
activity.setNavigator(uut);
|
|
102
101
|
|
|
103
|
-
ViewController initialChild = new SimpleViewController(activity, childRegistry, "initialChild", Options.EMPTY);
|
|
102
|
+
ViewController<?> initialChild = new SimpleViewController(activity, childRegistry, "initialChild", Options.EMPTY);
|
|
104
103
|
parentController = newStack(initialChild);
|
|
105
104
|
parentVisibilityListener = spy(new ViewController.ViewVisibilityListener() {
|
|
106
105
|
@Override
|
|
@@ -131,8 +130,8 @@ public class NavigatorTest extends BaseTest {
|
|
|
131
130
|
public void onConfigurationChange_shouldCallOnConfigurationChangedForModals() {
|
|
132
131
|
Navigator spyUUT = spy(uut);
|
|
133
132
|
SimpleViewController spyChild1 = spy(child1);
|
|
134
|
-
ViewController spyChild2 = spy(child2);
|
|
135
|
-
ViewController spyChild3 = spy(child3);
|
|
133
|
+
ViewController<?> spyChild2 = spy(child2);
|
|
134
|
+
ViewController<?> spyChild3 = spy(child3);
|
|
136
135
|
|
|
137
136
|
spyUUT.setRoot(spyChild1, new CommandListenerAdapter(), reactInstanceManager);
|
|
138
137
|
spyUUT.showModal(spyChild2, new CommandListenerAdapter());
|
|
@@ -147,8 +146,8 @@ public class NavigatorTest extends BaseTest {
|
|
|
147
146
|
public void onConfigurationChange_shouldCallOnConfigurationChangedForOverlays() {
|
|
148
147
|
Navigator spyUUT = spy(uut);
|
|
149
148
|
SimpleViewController spyChild1 = spy(child1);
|
|
150
|
-
ViewController spyChild2 = spy(child2);
|
|
151
|
-
ViewController spyChild3 = spy(child3);
|
|
149
|
+
ViewController<?> spyChild2 = spy(child2);
|
|
150
|
+
ViewController<?> spyChild3 = spy(child3);
|
|
152
151
|
|
|
153
152
|
spyUUT.setRoot(spyChild1, new CommandListenerAdapter(), reactInstanceManager);
|
|
154
153
|
spyUUT.showOverlay(spyChild2, new CommandListenerAdapter());
|
|
@@ -198,8 +197,8 @@ public class NavigatorTest extends BaseTest {
|
|
|
198
197
|
@Test
|
|
199
198
|
public void shouldCallOverlaysChildrenOnViewDidAppearOnHostResume() {
|
|
200
199
|
SimpleViewController child1 = spy(this.child1);
|
|
201
|
-
ViewController child2 = spy(this.child2);
|
|
202
|
-
ViewController child3 = spy(this.child3);
|
|
200
|
+
ViewController<?> child2 = spy(this.child2);
|
|
201
|
+
ViewController<?> child3 = spy(this.child3);
|
|
203
202
|
|
|
204
203
|
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
|
|
205
204
|
uut.showOverlay(child2, new CommandListenerAdapter());
|
|
@@ -220,7 +219,7 @@ public class NavigatorTest extends BaseTest {
|
|
|
220
219
|
final Options overContextOptions = tabOptions.copy();
|
|
221
220
|
overContextOptions.modal =new ModalOptions();
|
|
222
221
|
overContextOptions.modal.presentationStyle = ModalPresentationStyle.OverCurrentContext;
|
|
223
|
-
ViewController overContextModal = spy(new SimpleViewController(activity, childRegistry, "overContextModal",
|
|
222
|
+
ViewController<?> overContextModal = spy(new SimpleViewController(activity, childRegistry, "overContextModal",
|
|
224
223
|
overContextOptions));
|
|
225
224
|
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
|
|
226
225
|
uut.showModal(overContextModal, new CommandListenerAdapter());
|
|
@@ -236,7 +235,7 @@ public class NavigatorTest extends BaseTest {
|
|
|
236
235
|
final Options overContextOptions = tabOptions.copy();
|
|
237
236
|
overContextOptions.modal =new ModalOptions();
|
|
238
237
|
overContextOptions.modal.presentationStyle = ModalPresentationStyle.OverCurrentContext;
|
|
239
|
-
ViewController overContextModal = spy(new SimpleViewController(activity, childRegistry, "overContextModal",
|
|
238
|
+
ViewController<?> overContextModal = spy(new SimpleViewController(activity, childRegistry, "overContextModal",
|
|
240
239
|
overContextOptions));
|
|
241
240
|
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
|
|
242
241
|
uut.showModal(overContextModal, new CommandListenerAdapter());
|
|
@@ -249,11 +248,11 @@ public class NavigatorTest extends BaseTest {
|
|
|
249
248
|
@Test
|
|
250
249
|
public void shouldCallModalOnViewDisappearWhenModalDisplayedOverContextUnderneath(){
|
|
251
250
|
SimpleViewController child1 = spy(this.child1);
|
|
252
|
-
ViewController child2 = spy(this.child2);
|
|
251
|
+
ViewController<?> child2 = spy(this.child2);
|
|
253
252
|
final Options overContextOptions = tabOptions.copy();
|
|
254
253
|
overContextOptions.modal =new ModalOptions();
|
|
255
254
|
overContextOptions.modal.presentationStyle = ModalPresentationStyle.OverCurrentContext;
|
|
256
|
-
ViewController overContextModal = spy(new SimpleViewController(activity, childRegistry, "overContextModal",
|
|
255
|
+
ViewController<?> overContextModal = spy(new SimpleViewController(activity, childRegistry, "overContextModal",
|
|
257
256
|
overContextOptions));
|
|
258
257
|
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
|
|
259
258
|
uut.showModal(overContextModal, new CommandListenerAdapter());
|
|
@@ -266,9 +265,9 @@ public class NavigatorTest extends BaseTest {
|
|
|
266
265
|
@Test
|
|
267
266
|
public void shouldCallOverlaysAndModalsChildrenOnViewDidAppearOnHostResume() {
|
|
268
267
|
SimpleViewController child1 = spy(this.child1);
|
|
269
|
-
ViewController child2 = spy(this.child2);
|
|
270
|
-
ViewController child3 = spy(this.child3);
|
|
271
|
-
ViewController child4 = spy(this.child4);
|
|
268
|
+
ViewController<?> child2 = spy(this.child2);
|
|
269
|
+
ViewController<?> child3 = spy(this.child3);
|
|
270
|
+
ViewController<?> child4 = spy(this.child4);
|
|
272
271
|
|
|
273
272
|
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
|
|
274
273
|
uut.showModal(child2, new CommandListenerAdapter());
|
|
@@ -296,7 +295,7 @@ public class NavigatorTest extends BaseTest {
|
|
|
296
295
|
@Test
|
|
297
296
|
public void shouldCallModalPeekDidAppearWhenHostResumes() {
|
|
298
297
|
SimpleViewController child1 = spy(this.child1);
|
|
299
|
-
ViewController child2 = spy(this.child2);
|
|
298
|
+
ViewController<?> child2 = spy(this.child2);
|
|
300
299
|
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
|
|
301
300
|
uut.showModal(child2, new CommandListenerAdapter());
|
|
302
301
|
uut.onHostResume();
|
|
@@ -325,7 +324,7 @@ public class NavigatorTest extends BaseTest {
|
|
|
325
324
|
@Test
|
|
326
325
|
public void shouldCallModalPeekDidDisappearWhenHostPauses() {
|
|
327
326
|
SimpleViewController child1 = spy(this.child1);
|
|
328
|
-
ViewController child2 = spy(this.child2);
|
|
327
|
+
ViewController<?> child2 = spy(this.child2);
|
|
329
328
|
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
|
|
330
329
|
uut.showModal(child2, new CommandListenerAdapter());
|
|
331
330
|
uut.onHostPause();
|
|
@@ -383,11 +382,11 @@ public class NavigatorTest extends BaseTest {
|
|
|
383
382
|
|
|
384
383
|
@Test
|
|
385
384
|
public void setRoot_withWaitForRender() {
|
|
386
|
-
ViewController initialRoot = spy(child2);
|
|
385
|
+
ViewController<?> initialRoot = spy(child2);
|
|
387
386
|
uut.setRoot(initialRoot, new CommandListenerAdapter(), reactInstanceManager);
|
|
388
387
|
|
|
389
388
|
child3.options.animations.setRoot.getEnter().waitForRender = new Bool(true);
|
|
390
|
-
ViewController secondRoot = spy(child3);
|
|
389
|
+
ViewController<?> secondRoot = spy(child3);
|
|
391
390
|
CommandListenerAdapter listener = spy(new CommandListenerAdapter());
|
|
392
391
|
uut.setRoot(secondRoot, listener, reactInstanceManager);
|
|
393
392
|
|
|
@@ -552,7 +551,7 @@ public class NavigatorTest extends BaseTest {
|
|
|
552
551
|
public void handleBack_DelegatesToRoot() {
|
|
553
552
|
assertThat(uut.handleBack(new CommandListenerAdapter())).isFalse();
|
|
554
553
|
|
|
555
|
-
ViewController root = spy(child1);
|
|
554
|
+
ViewController<?> root = spy(child1);
|
|
556
555
|
uut.setRoot(root, new CommandListenerAdapter(), reactInstanceManager);
|
|
557
556
|
when(root.handleBack(any(CommandListener.class))).thenReturn(true);
|
|
558
557
|
assertThat(uut.handleBack(new CommandListenerAdapter())).isTrue();
|
|
@@ -561,7 +560,7 @@ public class NavigatorTest extends BaseTest {
|
|
|
561
560
|
|
|
562
561
|
@Test
|
|
563
562
|
public void handleBack_modalTakePrecedenceOverRoot() {
|
|
564
|
-
ViewController root = spy(child1);
|
|
563
|
+
ViewController<?> root = spy(child1);
|
|
565
564
|
uut.setRoot(root, new CommandListenerAdapter(), reactInstanceManager);
|
|
566
565
|
uut.showModal(child2, new CommandListenerAdapter());
|
|
567
566
|
verify(root, times(0)).handleBack(new CommandListenerAdapter());
|
|
@@ -886,7 +885,7 @@ public class NavigatorTest extends BaseTest {
|
|
|
886
885
|
}
|
|
887
886
|
|
|
888
887
|
@NonNull
|
|
889
|
-
private StackController newStack(ViewController
|
|
888
|
+
private StackController newStack(ViewController<?>... children) {
|
|
890
889
|
StackController stack = TestUtils.newStackController(activity)
|
|
891
890
|
.setChildren(children)
|
|
892
891
|
.setChildRegistry(childRegistry)
|
|
@@ -47,12 +47,12 @@ class RootPresenterTest : BaseTest() {
|
|
|
47
47
|
|
|
48
48
|
root = object : SimpleViewController(activity, ChildControllersRegistry(), "child1", Options()) {
|
|
49
49
|
override fun createView(): SimpleView {
|
|
50
|
-
return root1View
|
|
50
|
+
return root1View
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
root2 = object : SimpleViewController(activity, ChildControllersRegistry(), "child1", Options()) {
|
|
54
54
|
override fun createView(): SimpleView {
|
|
55
|
-
return root2View
|
|
55
|
+
return root2View
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
setupWithAnimator(Mockito.spy(createAnimator()))
|
|
@@ -41,8 +41,8 @@ public class ParentControllerTest extends BaseTest {
|
|
|
41
41
|
private static final String INITIAL_TITLE = "initial title";
|
|
42
42
|
private Activity activity;
|
|
43
43
|
private ChildControllersRegistry childRegistry;
|
|
44
|
-
private List<ViewController
|
|
45
|
-
private ParentController uut;
|
|
44
|
+
private List<ViewController<?>> children;
|
|
45
|
+
private ParentController<?> uut;
|
|
46
46
|
private Presenter presenter;
|
|
47
47
|
|
|
48
48
|
@Override
|
|
@@ -54,10 +54,10 @@ public class ParentControllerTest extends BaseTest {
|
|
|
54
54
|
Options initialOptions = new Options();
|
|
55
55
|
initialOptions.topBar.title.text = new Text(INITIAL_TITLE);
|
|
56
56
|
presenter = spy(new Presenter(activity, new Options()));
|
|
57
|
-
uut = spy(new ParentController(activity, childRegistry, "uut", presenter, initialOptions) {
|
|
57
|
+
uut = spy(new ParentController<ViewGroup>(activity, childRegistry, "uut", presenter, initialOptions) {
|
|
58
58
|
|
|
59
59
|
@Override
|
|
60
|
-
public ViewController getCurrentChild() {
|
|
60
|
+
public ViewController<?> getCurrentChild() {
|
|
61
61
|
return children.get(0);
|
|
62
62
|
}
|
|
63
63
|
|
|
@@ -65,7 +65,7 @@ public class ParentControllerTest extends BaseTest {
|
|
|
65
65
|
@Override
|
|
66
66
|
public ViewGroup createView() {
|
|
67
67
|
FrameLayout layout = new FrameLayout(activity);
|
|
68
|
-
for (ViewController child : children) {
|
|
68
|
+
for (ViewController<?> child : children) {
|
|
69
69
|
child.setParentController(this);
|
|
70
70
|
layout.addView(child.getView());
|
|
71
71
|
}
|
|
@@ -79,7 +79,7 @@ public class ParentControllerTest extends BaseTest {
|
|
|
79
79
|
|
|
80
80
|
@NonNull
|
|
81
81
|
@Override
|
|
82
|
-
public Collection<ViewController
|
|
82
|
+
public Collection<ViewController<?>> getChildControllers() {
|
|
83
83
|
return children;
|
|
84
84
|
}
|
|
85
85
|
});
|
|
@@ -89,10 +89,10 @@ public class ParentControllerTest extends BaseTest {
|
|
|
89
89
|
public void onConfigurationChange_shouldCallConfigurationChangeForPresenterAndChildren() {
|
|
90
90
|
children.add(spy(new SimpleViewController(activity, childRegistry, "child1", new Options())));
|
|
91
91
|
children.add(spy(new SimpleViewController(activity, childRegistry, "child2", new Options())));
|
|
92
|
-
ParentController spyUUT = spy(uut);
|
|
92
|
+
ParentController<?> spyUUT = spy(uut);
|
|
93
93
|
spyUUT.onConfigurationChanged(mockConfiguration);
|
|
94
94
|
verify(presenter).onConfigurationChanged(any(),any());
|
|
95
|
-
for (ViewController controller : children) {
|
|
95
|
+
for (ViewController<?> controller : children) {
|
|
96
96
|
verify(controller).onConfigurationChanged(any());
|
|
97
97
|
}
|
|
98
98
|
}
|
|
@@ -158,7 +158,7 @@ public class ParentControllerTest extends BaseTest {
|
|
|
158
158
|
|
|
159
159
|
@Test
|
|
160
160
|
public void destroy_DestroysChildren() {
|
|
161
|
-
ViewController child1 = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
|
|
161
|
+
ViewController<?> child1 = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
|
|
162
162
|
children.add(child1);
|
|
163
163
|
|
|
164
164
|
verify(child1, times(0)).destroy();
|
|
@@ -181,7 +181,7 @@ public class ParentControllerTest extends BaseTest {
|
|
|
181
181
|
public void mergeOptions_optionsAreMergedWhenChildAppears() {
|
|
182
182
|
Options options = new Options();
|
|
183
183
|
options.topBar.title.text = new Text("new title");
|
|
184
|
-
ViewController child1 = spy(new SimpleViewController(activity, childRegistry, "child1", options));
|
|
184
|
+
ViewController<?> child1 = spy(new SimpleViewController(activity, childRegistry, "child1", options));
|
|
185
185
|
children.add(child1);
|
|
186
186
|
uut.ensureViewIsCreated();
|
|
187
187
|
|
|
@@ -197,7 +197,7 @@ public class ParentControllerTest extends BaseTest {
|
|
|
197
197
|
public void mergeOptions_initialParentOptionsAreNotMutatedWhenChildAppears() {
|
|
198
198
|
Options options = new Options();
|
|
199
199
|
options.topBar.title.text = new Text("new title");
|
|
200
|
-
ViewController child1 = spy(new SimpleViewController(activity, childRegistry, "child1", options));
|
|
200
|
+
ViewController<?> child1 = spy(new SimpleViewController(activity, childRegistry, "child1", options));
|
|
201
201
|
children.add(child1);
|
|
202
202
|
|
|
203
203
|
uut.ensureViewIsCreated();
|
|
@@ -243,7 +243,7 @@ public class ParentControllerTest extends BaseTest {
|
|
|
243
243
|
|
|
244
244
|
Options defaultOptions = new Options();
|
|
245
245
|
Options currentOptions = spy(new Options());
|
|
246
|
-
ParentController spy = spy(uut);
|
|
246
|
+
ParentController<?> spy = spy(uut);
|
|
247
247
|
Mockito.when(spy.resolveCurrentOptions()).thenReturn(currentOptions);
|
|
248
248
|
spy.resolveCurrentOptions(defaultOptions);
|
|
249
249
|
verify(currentOptions).withDefaultOptions(defaultOptions);
|
|
@@ -263,7 +263,7 @@ public class ParentControllerTest extends BaseTest {
|
|
|
263
263
|
|
|
264
264
|
@Test
|
|
265
265
|
public void getTopInsetForChild() {
|
|
266
|
-
ParentController parent = Mockito.mock(ParentController.class);
|
|
266
|
+
ParentController<?> parent = Mockito.mock(ParentController.class);
|
|
267
267
|
when(parent.getTopInset(any())).thenReturn(123);
|
|
268
268
|
uut.setParentController(parent);
|
|
269
269
|
|
|
@@ -279,14 +279,14 @@ public class ParentControllerTest extends BaseTest {
|
|
|
279
279
|
|
|
280
280
|
@Test
|
|
281
281
|
public void getBottomInsetForChild() {
|
|
282
|
-
ParentController parent = Mockito.mock(ParentController.class);
|
|
282
|
+
ParentController<?> parent = Mockito.mock(ParentController.class);
|
|
283
283
|
when(parent.getBottomInset(any())).thenReturn(123);
|
|
284
284
|
uut.setParentController(parent);
|
|
285
285
|
|
|
286
286
|
assertThat(uut.getBottomInset(Mockito.mock(ViewController.class))).isEqualTo(123);
|
|
287
287
|
}
|
|
288
288
|
|
|
289
|
-
private List<ViewController
|
|
289
|
+
private List<ViewController<?>> createChildren() {
|
|
290
290
|
return Arrays.asList(
|
|
291
291
|
spy(new SimpleViewController(activity, childRegistry, "child1", new Options())),
|
|
292
292
|
spy(new SimpleViewController(activity, childRegistry, "child2", new Options()))
|
|
@@ -46,11 +46,11 @@ public class SideMenuControllerTest extends BaseTest {
|
|
|
46
46
|
private Activity activity;
|
|
47
47
|
private ChildControllersRegistry childRegistry;
|
|
48
48
|
private SideMenuPresenter presenter;
|
|
49
|
-
private ViewController left;
|
|
50
|
-
private ViewController right;
|
|
51
|
-
private ViewController center;
|
|
52
|
-
private ViewController child;
|
|
53
|
-
private ParentController parent;
|
|
49
|
+
private ViewController<?> left;
|
|
50
|
+
private ViewController<?> right;
|
|
51
|
+
private ViewController<?> center;
|
|
52
|
+
private ViewController<?> child;
|
|
53
|
+
private ParentController<?> parent;
|
|
54
54
|
private Options resolvedOptions;
|
|
55
55
|
|
|
56
56
|
@Override
|
|
@@ -118,12 +118,12 @@ public class SideMenuControllerTest extends BaseTest {
|
|
|
118
118
|
|
|
119
119
|
@Test
|
|
120
120
|
public void onViewAppeared() {
|
|
121
|
-
ViewController left = spy(this.left);
|
|
121
|
+
ViewController<?> left = spy(this.left);
|
|
122
122
|
ViewGroup leftView = spy(left.getView());
|
|
123
123
|
when(left.findController(leftView)).thenReturn(left);
|
|
124
124
|
Mockito.doReturn(leftView).when(left).getView();
|
|
125
125
|
|
|
126
|
-
ViewController right = spy(this.right);
|
|
126
|
+
ViewController<?> right = spy(this.right);
|
|
127
127
|
ViewGroup rightView = spy(right.getView());
|
|
128
128
|
when(right.findController(rightView)).thenReturn(right);
|
|
129
129
|
Mockito.doReturn(rightView).when(right).getView();
|
|
@@ -373,7 +373,7 @@ public class SideMenuControllerTest extends BaseTest {
|
|
|
373
373
|
forEach(uut.getChildControllers(), c -> verify(c).applyTopInset());
|
|
374
374
|
}
|
|
375
375
|
|
|
376
|
-
private void openDrawerAndAssertVisibility(ViewController side, Functions.FuncR1<ViewController
|
|
376
|
+
private void openDrawerAndAssertVisibility(ViewController<?> side, Functions.FuncR1<ViewController<?>, SideMenuOptions> opt) {
|
|
377
377
|
Options options = new Options();
|
|
378
378
|
(side == left ? options.sideMenuRootOptions.left : options.sideMenuRootOptions.right).visible = new Bool(true);
|
|
379
379
|
uut.mergeOptions(options);
|
|
@@ -381,7 +381,7 @@ public class SideMenuControllerTest extends BaseTest {
|
|
|
381
381
|
assertThat(opt.run(side).visible.isFalseOrUndefined()).isTrue();
|
|
382
382
|
}
|
|
383
383
|
|
|
384
|
-
private void closeDrawerAndAssertVisibility(ViewController side, Functions.FuncR1<ViewController
|
|
384
|
+
private void closeDrawerAndAssertVisibility(ViewController<?> side, Functions.FuncR1<ViewController<?>, SideMenuOptions> opt) {
|
|
385
385
|
Options options = new Options();
|
|
386
386
|
(side == left ? options.sideMenuRootOptions.left : options.sideMenuRootOptions.right).visible = new Bool(false);
|
|
387
387
|
uut.mergeOptions(options);
|
|
@@ -389,7 +389,7 @@ public class SideMenuControllerTest extends BaseTest {
|
|
|
389
389
|
assertThat(opt.run(side).visible.isTrue()).isFalse();
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
-
private int getGravity(ViewController side) {
|
|
392
|
+
private int getGravity(ViewController<?> side) {
|
|
393
393
|
return side == left ? Gravity.LEFT : Gravity.RIGHT;
|
|
394
394
|
}
|
|
395
395
|
|
|
@@ -433,7 +433,7 @@ public class SideMenuControllerTest extends BaseTest {
|
|
|
433
433
|
return activity;
|
|
434
434
|
}
|
|
435
435
|
|
|
436
|
-
private void setLeftRight(ViewController left, ViewController right) {
|
|
436
|
+
private void setLeftRight(ViewController<?> left, ViewController<?> right) {
|
|
437
437
|
uut.setLeftController(left);
|
|
438
438
|
uut.setRightController(right);
|
|
439
439
|
left.setParentController(uut);
|
|
@@ -24,8 +24,8 @@ import static org.mockito.Mockito.verify;
|
|
|
24
24
|
public class BackButtonHelperTest extends BaseTest {
|
|
25
25
|
private BackButtonHelper uut;
|
|
26
26
|
private StackController stack;
|
|
27
|
-
private ChildController child1;
|
|
28
|
-
private ChildController child2;
|
|
27
|
+
private ChildController<?> child1;
|
|
28
|
+
private ChildController<?> child2;
|
|
29
29
|
|
|
30
30
|
@Override
|
|
31
31
|
public void beforeEach() {
|
|
@@ -3,9 +3,6 @@ package com.reactnativenavigation.viewcontrollers.stack
|
|
|
3
3
|
import android.animation.AnimatorSet
|
|
4
4
|
import android.animation.ObjectAnimator
|
|
5
5
|
import android.app.Activity
|
|
6
|
-
import android.os.Looper
|
|
7
|
-
import android.view.View
|
|
8
|
-
import android.view.ViewGroup
|
|
9
6
|
import android.widget.FrameLayout
|
|
10
7
|
import com.nhaarman.mockitokotlin2.*
|
|
11
8
|
import com.reactnativenavigation.BaseTest
|
|
@@ -19,7 +16,6 @@ import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController
|
|
|
19
16
|
import com.reactnativenavigation.views.element.TransitionAnimatorCreator
|
|
20
17
|
import org.assertj.core.api.Java6Assertions.assertThat
|
|
21
18
|
import org.junit.Test
|
|
22
|
-
import org.robolectric.Shadows
|
|
23
19
|
|
|
24
20
|
class StackAnimatorTest : BaseTest() {
|
|
25
21
|
private lateinit var uut: StackAnimator
|
|
@@ -73,7 +73,7 @@ class StackControllerTest : BaseTest() {
|
|
|
73
73
|
TypefaceLoaderMock(),
|
|
74
74
|
RenderChecker(),
|
|
75
75
|
Options()
|
|
76
|
-
|
|
76
|
+
)
|
|
77
77
|
)
|
|
78
78
|
createChildren()
|
|
79
79
|
uut = createStack()
|
|
@@ -182,7 +182,7 @@ class StackControllerTest : BaseTest() {
|
|
|
182
182
|
child2.options.topBar.buttons.left = ArrayList(setOf(TitleBarHelper.iconButton("someButton", "icon.png")))
|
|
183
183
|
uut.push(child2, CommandListenerAdapter())
|
|
184
184
|
ShadowLooper.idleMainLooper()
|
|
185
|
-
assertThat(topBarController.leftButtonCount).isOne()
|
|
185
|
+
assertThat(topBarController.leftButtonCount).isOne()
|
|
186
186
|
verify(topBarController.view, never()).setBackButton(any())
|
|
187
187
|
}
|
|
188
188
|
|
|
@@ -562,7 +562,7 @@ class StackControllerTest : BaseTest() {
|
|
|
562
562
|
val captor = argumentCaptor<Options>()
|
|
563
563
|
verify(animator).pop(any(), any(), captor.capture(), any(), any())
|
|
564
564
|
val animator = captor.firstValue.animations.pop.content.exit
|
|
565
|
-
|
|
565
|
+
.getAnimation(mockView(activity))
|
|
566
566
|
assertThat((animator as AnimatorSet).childAnimations.first().duration).isEqualTo(123)
|
|
567
567
|
}
|
|
568
568
|
|
|
@@ -579,7 +579,7 @@ class StackControllerTest : BaseTest() {
|
|
|
579
579
|
val captor = argumentCaptor<Options>()
|
|
580
580
|
verify(animator).pop(any(), any(), captor.capture(), any(), any())
|
|
581
581
|
val animator = captor.firstValue.animations.pop.content.exit
|
|
582
|
-
|
|
582
|
+
.getAnimation(mockView(activity))
|
|
583
583
|
assertThat((animator as AnimatorSet).childAnimations.first().duration).isEqualTo(123)
|
|
584
584
|
}
|
|
585
585
|
|
|
@@ -980,8 +980,8 @@ class StackControllerTest : BaseTest() {
|
|
|
980
980
|
@Test
|
|
981
981
|
fun mergeChildOptions_updatesParentControllerWithNewOptions() {
|
|
982
982
|
val uut = TestUtils.newStackController(activity)
|
|
983
|
-
|
|
984
|
-
|
|
983
|
+
.setId("stack")
|
|
984
|
+
.build()
|
|
985
985
|
val parentController = mock<ParentController<*>>()
|
|
986
986
|
uut.parentController = parentController
|
|
987
987
|
uut.ensureViewIsCreated()
|
|
@@ -1119,7 +1119,7 @@ class StackControllerTest : BaseTest() {
|
|
|
1119
1119
|
private fun assertContainsOnlyId(vararg ids: String) {
|
|
1120
1120
|
assertThat(uut.size()).isEqualTo(ids.size)
|
|
1121
1121
|
assertThat(uut.childControllers).extracting(Extractor { obj: ViewController<*> -> obj.id } as Extractor<ViewController<*>, String>)
|
|
1122
|
-
|
|
1122
|
+
.containsOnly(*ids)
|
|
1123
1123
|
}
|
|
1124
1124
|
|
|
1125
1125
|
private fun createStack(): StackController {
|
|
@@ -1137,14 +1137,14 @@ class StackControllerTest : BaseTest() {
|
|
|
1137
1137
|
private fun createStackBuilder(id: String, children: List<ViewController<*>>): StackControllerBuilder {
|
|
1138
1138
|
createTopBarController()
|
|
1139
1139
|
return TestUtils.newStackController(activity)
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1140
|
+
.setEventEmitter(eventEmitter)
|
|
1141
|
+
.setChildren(children)
|
|
1142
|
+
.setId(id)
|
|
1143
|
+
.setTopBarController(topBarController)
|
|
1144
|
+
.setChildRegistry(childRegistry)
|
|
1145
|
+
.setAnimator(animator)
|
|
1146
|
+
.setStackPresenter(presenter)
|
|
1147
|
+
.setBackButtonHelper(backButtonHelper)
|
|
1148
1148
|
}
|
|
1149
1149
|
|
|
1150
1150
|
private fun createTopBarController() {
|
|
@@ -76,21 +76,21 @@ class StackPresenterTest : BaseTest() {
|
|
|
76
76
|
iconResolver = IconResolverFake(activity)
|
|
77
77
|
buttonCreator = TitleBarButtonCreatorMock()
|
|
78
78
|
ogUut = StackPresenter(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
79
|
+
activity,
|
|
80
|
+
titleViewCreator,
|
|
81
|
+
TopBarBackgroundViewCreatorMock(),
|
|
82
|
+
buttonCreator,
|
|
83
|
+
iconResolver,
|
|
84
|
+
typefaceLoader,
|
|
85
|
+
renderChecker,
|
|
86
|
+
Options()
|
|
87
87
|
)
|
|
88
88
|
uut = spy(ogUut)
|
|
89
89
|
createTopBarController()
|
|
90
90
|
parent = TestUtils.newStackController(activity)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
91
|
+
.setTopBarController(topBarController)
|
|
92
|
+
.setStackPresenter(uut)
|
|
93
|
+
.build()
|
|
94
94
|
childRegistry = ChildControllersRegistry()
|
|
95
95
|
child = spy(SimpleViewController(activity, childRegistry, "child1", Options.EMPTY))
|
|
96
96
|
otherChild = spy(SimpleViewController(activity, childRegistry, "child1", Options.EMPTY))
|
|
@@ -768,9 +768,9 @@ class StackPresenterTest : BaseTest() {
|
|
|
768
768
|
uut.setComponentsButtonController(child.view, rightController, leftController)
|
|
769
769
|
uut.mergeChildOptions(mergeOptions, initialOptions, parent, child)
|
|
770
770
|
|
|
771
|
-
verify(rightController, never()).applyColor(any(), any())
|
|
772
|
-
verify(leftController, never()).applyColor(any(), any())
|
|
773
|
-
verify(leftController, never()).applyDisabledColor(any(), any())
|
|
771
|
+
verify(rightController, never()).applyColor(any(), any())
|
|
772
|
+
verify(leftController, never()).applyColor(any(), any())
|
|
773
|
+
verify(leftController, never()).applyDisabledColor(any(), any())
|
|
774
774
|
verify(leftController, never()).applyDisabledColor(any(), any())
|
|
775
775
|
|
|
776
776
|
}
|
|
@@ -837,7 +837,7 @@ class StackPresenterTest : BaseTest() {
|
|
|
837
837
|
val rightCaptor = argumentCaptor<List<ButtonController>>()
|
|
838
838
|
val leftCaptor = argumentCaptor<List<ButtonController>>()
|
|
839
839
|
verify(topBarController).applyRightButtons(rightCaptor.capture())
|
|
840
|
-
verify(topBarController).applyLeftButtons(leftCaptor.capture())
|
|
840
|
+
verify(topBarController).applyLeftButtons(leftCaptor.capture())
|
|
841
841
|
assertThat(rightCaptor.firstValue.size).isOne()
|
|
842
842
|
assertThat(leftCaptor.firstValue.size).isOne()
|
|
843
843
|
}
|
|
@@ -897,8 +897,8 @@ class StackPresenterTest : BaseTest() {
|
|
|
897
897
|
val options = Options().apply {
|
|
898
898
|
topBar.buttons.right = ArrayList(listOf(componentBtn1))
|
|
899
899
|
topBar.buttons.left = ArrayList(listOf(componentBtn2))
|
|
900
|
-
topBar.animateLeftButtons = Bool(false)
|
|
901
|
-
topBar.animateRightButtons = Bool(true)
|
|
900
|
+
topBar.animateLeftButtons = Bool(false)
|
|
901
|
+
topBar.animateRightButtons = Bool(true)
|
|
902
902
|
}
|
|
903
903
|
|
|
904
904
|
uut.applyChildOptions(options, parent, child)
|
|
@@ -107,10 +107,10 @@ class TopBarControllerTest : BaseTest() {
|
|
|
107
107
|
fun setLeftButtons_emptyButtonsListClearsLeftButton() {
|
|
108
108
|
uut.applyLeftButtons(leftButton(leftButton))
|
|
109
109
|
uut.applyRightButtons(rightButtons(componentButton)!!)
|
|
110
|
-
assertThat(uut.leftButtonCount).isNotZero()
|
|
110
|
+
assertThat(uut.leftButtonCount).isNotZero()
|
|
111
111
|
uut.applyLeftButtons(emptyList())
|
|
112
112
|
uut.applyRightButtons(rightButtons(textButton1)!!)
|
|
113
|
-
assertThat(uut.leftButtonCount).isZero()
|
|
113
|
+
assertThat(uut.leftButtonCount).isZero()
|
|
114
114
|
}
|
|
115
115
|
|
|
116
116
|
@Test
|
|
@@ -142,7 +142,7 @@ class TopBarControllerTest : BaseTest() {
|
|
|
142
142
|
uut.view.setBackButton(TitleBarHelper.createButtonController(activity, backButton))
|
|
143
143
|
assertThat(uut.view.navigationIcon).isNotNull()
|
|
144
144
|
val initialButtons = leftButton(leftButton)
|
|
145
|
-
uut.applyLeftButtons(initialButtons
|
|
145
|
+
uut.applyLeftButtons(initialButtons)
|
|
146
146
|
uut.mergeLeftButtons(initialButtons, emptyList())
|
|
147
147
|
assertThat(uut.view.navigationIcon).isNull()
|
|
148
148
|
}
|
|
@@ -44,7 +44,7 @@ public class TopTabsViewControllerTest extends BaseTest {
|
|
|
44
44
|
|
|
45
45
|
private StackController stack;
|
|
46
46
|
private TopTabsController uut;
|
|
47
|
-
private List<ViewController
|
|
47
|
+
private List<ViewController<?>> tabControllers = new ArrayList<>(SIZE);
|
|
48
48
|
private final Options options = new Options();
|
|
49
49
|
private TopTabsViewPager topTabsLayout;
|
|
50
50
|
private Activity activity;
|
|
@@ -73,7 +73,7 @@ public class TopTabsViewControllerTest extends BaseTest {
|
|
|
73
73
|
|
|
74
74
|
@NonNull
|
|
75
75
|
private ArrayList<Options> createOptions() {
|
|
76
|
-
ArrayList result = new ArrayList();
|
|
76
|
+
ArrayList<Options> result = new ArrayList<>();
|
|
77
77
|
for (int i = 0; i < SIZE; i++) {
|
|
78
78
|
final Options options = new Options();
|
|
79
79
|
options.topTabOptions.title = new Text("Tab " + i);
|
|
@@ -83,8 +83,8 @@ public class TopTabsViewControllerTest extends BaseTest {
|
|
|
83
83
|
return result;
|
|
84
84
|
}
|
|
85
85
|
|
|
86
|
-
private List<ViewController
|
|
87
|
-
List<ViewController
|
|
86
|
+
private List<ViewController<?>> createTabsControllers(Activity activity, List<Options> tabOptions) {
|
|
87
|
+
List<ViewController<?>> tabControllers = new ArrayList<>(SIZE);
|
|
88
88
|
for (int i = 0; i < SIZE; i++) {
|
|
89
89
|
ComponentViewController viewController = new ComponentViewController(
|
|
90
90
|
activity,
|
|
@@ -117,7 +117,7 @@ public class TopTabsViewControllerTest extends BaseTest {
|
|
|
117
117
|
verify(tab(topTabs, i), times(0)).destroy();
|
|
118
118
|
}
|
|
119
119
|
uut.destroy();
|
|
120
|
-
for (ViewController tabController : tabControllers) {
|
|
120
|
+
for (ViewController<?> tabController : tabControllers) {
|
|
121
121
|
verify(tabController, times(1)).destroy();
|
|
122
122
|
}
|
|
123
123
|
}
|
|
@@ -162,7 +162,7 @@ public class TopTabsViewControllerTest extends BaseTest {
|
|
|
162
162
|
verify(tabControllers.get(0), times(1)).onViewWillAppear();
|
|
163
163
|
verify(tabControllers.get(1), times(0)).onViewWillAppear();
|
|
164
164
|
|
|
165
|
-
ViewController comp = tabControllers.get(0);
|
|
165
|
+
ViewController<?> comp = tabControllers.get(0);
|
|
166
166
|
verify(uut, times(1)).applyChildOptions(any(Options.class), eq(comp));
|
|
167
167
|
}
|
|
168
168
|
|
|
@@ -174,7 +174,7 @@ public class TopTabsViewControllerTest extends BaseTest {
|
|
|
174
174
|
tabControllers.get(1).ensureViewIsCreated();
|
|
175
175
|
|
|
176
176
|
uut.onViewWillAppear();
|
|
177
|
-
ViewController currentTab = tab(0);
|
|
177
|
+
ViewController<?> currentTab = tab(0);
|
|
178
178
|
verify(uut, times(1)).applyChildOptions(any(Options.class), eq(currentTab));
|
|
179
179
|
assertThat(uut.options.topBar.title.text.get()).isEqualTo(createTabTopBarTitle(0));
|
|
180
180
|
|
|
@@ -208,7 +208,7 @@ public class TopTabsViewControllerTest extends BaseTest {
|
|
|
208
208
|
public void applyOptions_tabsAreRemovedAfterViewDisappears() {
|
|
209
209
|
StackController stackController = TestUtils.newStackController(activity).build();
|
|
210
210
|
stackController.ensureViewIsCreated();
|
|
211
|
-
ViewController first = new SimpleViewController(activity, childRegistry, "first", Options.EMPTY);
|
|
211
|
+
ViewController<?> first = new SimpleViewController(activity, childRegistry, "first", Options.EMPTY);
|
|
212
212
|
disablePushAnimation(first, uut);
|
|
213
213
|
stackController.push(first, new CommandListenerAdapter());
|
|
214
214
|
stackController.push(uut, new CommandListenerAdapter());
|
|
@@ -241,7 +241,7 @@ public class TopTabsViewControllerTest extends BaseTest {
|
|
|
241
241
|
return "Title " + i;
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
-
private ViewController tab(int index) {
|
|
244
|
+
private ViewController<?> tab(int index) {
|
|
245
245
|
return tabControllers.get(index);
|
|
246
246
|
}
|
|
247
247
|
}
|
package/lib/dist/Navigation.d.ts
CHANGED
|
@@ -65,7 +65,7 @@ export declare class NavigationRoot {
|
|
|
65
65
|
/**
|
|
66
66
|
* Update a mounted component's props
|
|
67
67
|
*/
|
|
68
|
-
updateProps(componentId: string, props: object): void;
|
|
68
|
+
updateProps(componentId: string, props: object, callback?: () => void): void;
|
|
69
69
|
/**
|
|
70
70
|
* Show a screen as a modal.
|
|
71
71
|
*/
|
package/lib/dist/Navigation.js
CHANGED
|
@@ -98,8 +98,8 @@ class NavigationRoot {
|
|
|
98
98
|
/**
|
|
99
99
|
* Update a mounted component's props
|
|
100
100
|
*/
|
|
101
|
-
updateProps(componentId, props) {
|
|
102
|
-
this.commands.updateProps(componentId, props);
|
|
101
|
+
updateProps(componentId, props, callback) {
|
|
102
|
+
this.commands.updateProps(componentId, props, callback);
|
|
103
103
|
}
|
|
104
104
|
/**
|
|
105
105
|
* Show a screen as a modal.
|