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
|
@@ -5,6 +5,8 @@ import android.content.Context;
|
|
|
5
5
|
import android.view.View;
|
|
6
6
|
import android.view.ViewGroup;
|
|
7
7
|
|
|
8
|
+
import androidx.annotation.NonNull;
|
|
9
|
+
|
|
8
10
|
import com.reactnativenavigation.mocks.TitleBarReactViewCreatorMock;
|
|
9
11
|
import com.reactnativenavigation.mocks.TopBarBackgroundViewCreatorMock;
|
|
10
12
|
import com.reactnativenavigation.mocks.TitleBarButtonCreatorMock;
|
|
@@ -31,7 +33,7 @@ public class TestUtils {
|
|
|
31
33
|
public static StackControllerBuilder newStackController(Activity activity) {
|
|
32
34
|
TopBarController topBarController = new TopBarController() {
|
|
33
35
|
@Override
|
|
34
|
-
protected TopBar createTopBar(Context context, StackLayout stackLayout) {
|
|
36
|
+
protected TopBar createTopBar(@NonNull Context context, @NonNull StackLayout stackLayout) {
|
|
35
37
|
TopBar topBar = super.createTopBar(context, stackLayout);
|
|
36
38
|
topBar.layout(0, 0, 1000, UiUtils.getTopBarHeight(context));
|
|
37
39
|
return topBar;
|
|
@@ -45,7 +47,7 @@ public class TestUtils {
|
|
|
45
47
|
.setInitialOptions(new Options());
|
|
46
48
|
}
|
|
47
49
|
|
|
48
|
-
public static void hideBackButton(ViewController viewController) {
|
|
50
|
+
public static void hideBackButton(ViewController<?> viewController) {
|
|
49
51
|
viewController.options.topBar.buttons.back.visible = new Bool(false);
|
|
50
52
|
}
|
|
51
53
|
|
package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentLayout.java
CHANGED
|
@@ -4,6 +4,8 @@ import android.content.Context;
|
|
|
4
4
|
import android.view.MotionEvent;
|
|
5
5
|
import android.view.ViewGroup;
|
|
6
6
|
|
|
7
|
+
import androidx.annotation.NonNull;
|
|
8
|
+
|
|
7
9
|
import com.reactnativenavigation.options.ButtonOptions;
|
|
8
10
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.ScrollEventListener;
|
|
9
11
|
import com.reactnativenavigation.options.Options;
|
|
@@ -71,7 +73,7 @@ public class TestComponentLayout extends ComponentLayout implements ButtonContro
|
|
|
71
73
|
}
|
|
72
74
|
|
|
73
75
|
@Override
|
|
74
|
-
public void onPress(ButtonOptions button) {
|
|
76
|
+
public void onPress(@NonNull ButtonOptions button) {
|
|
75
77
|
|
|
76
78
|
}
|
|
77
79
|
}
|
|
@@ -40,6 +40,7 @@ public class OptionsTest extends BaseTest {
|
|
|
40
40
|
private static final int TOP_BAR_TEXT_COLOR = 0xff123456;
|
|
41
41
|
private static final int TOP_BAR_FONT_SIZE = 18;
|
|
42
42
|
private static final String TOP_BAR_FONT_FAMILY = "HelveticaNeue-CondensedBold";
|
|
43
|
+
private static final String BACK_BUTTON_ACCESSIBILITY_LABEL = "Go Back My Accessibility Label";
|
|
43
44
|
private static final int SUBTITLE_FONT_SIZE = 14;
|
|
44
45
|
private static final int SUBTITLE_TEXT_COLOR = 0xff123457;
|
|
45
46
|
private static final int SCREEN_BACKGROUND_COLOR = 0xff123458;
|
|
@@ -101,6 +102,7 @@ public class OptionsTest extends BaseTest {
|
|
|
101
102
|
assertThat(result.topBar.visible.get()).isEqualTo(TOP_BAR_VISIBLE.get());
|
|
102
103
|
assertThat(result.topBar.drawBehind.get()).isEqualTo(TOP_BAR_DRAW_BEHIND.get());
|
|
103
104
|
assertThat(result.topBar.hideOnScroll.get()).isEqualTo(TOP_BAR_HIDE_ON_SCROLL.get());
|
|
105
|
+
assertThat(result.topBar.buttons.back.accessibilityLabel.get()).isEqualTo(BACK_BUTTON_ACCESSIBILITY_LABEL);
|
|
104
106
|
assertThat(result.bottomTabsOptions.animate.get()).isEqualTo(BOTTOM_TABS_ANIMATE.get());
|
|
105
107
|
assertThat(result.bottomTabsOptions.visible.get()).isEqualTo(BOTTOM_TABS_VISIBLE.get());
|
|
106
108
|
assertThat(result.fabOptions.id.get()).isEqualTo(FAB_ID);
|
|
@@ -123,6 +125,11 @@ public class OptionsTest extends BaseTest {
|
|
|
123
125
|
.put("animate", BOTTOM_TABS_ANIMATE.get());
|
|
124
126
|
}
|
|
125
127
|
|
|
128
|
+
private JSONObject createBackButton() throws JSONException {
|
|
129
|
+
return new JSONObject()
|
|
130
|
+
.put("accessibilityLabel", BACK_BUTTON_ACCESSIBILITY_LABEL);
|
|
131
|
+
}
|
|
132
|
+
|
|
126
133
|
@NonNull
|
|
127
134
|
private JSONObject createTopBar(boolean visible) throws JSONException {
|
|
128
135
|
return new JSONObject()
|
|
@@ -131,7 +138,8 @@ public class OptionsTest extends BaseTest {
|
|
|
131
138
|
.put("background", createBackground())
|
|
132
139
|
.put("visible", visible)
|
|
133
140
|
.put("drawBehind", TOP_BAR_DRAW_BEHIND.get())
|
|
134
|
-
.put("hideOnScroll", TOP_BAR_HIDE_ON_SCROLL.get())
|
|
141
|
+
.put("hideOnScroll", TOP_BAR_HIDE_ON_SCROLL.get())
|
|
142
|
+
.put("backButton", createBackButton());
|
|
135
143
|
}
|
|
136
144
|
|
|
137
145
|
private JSONObject createBackground() throws JSONException {
|
package/lib/android/app/src/test/java/com/reactnativenavigation/options/TopBarButtonsTest.kt
CHANGED
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
package com.reactnativenavigation.options
|
|
2
2
|
|
|
3
|
+
import android.app.Activity
|
|
3
4
|
import com.reactnativenavigation.BaseTest
|
|
4
5
|
import org.assertj.core.api.Java6Assertions
|
|
5
6
|
import org.assertj.core.api.Java6Assertions.assertThat
|
|
7
|
+
import org.json.JSONObject
|
|
6
8
|
import org.junit.Test
|
|
9
|
+
import java.lang.Exception
|
|
7
10
|
import kotlin.test.assertTrue
|
|
8
11
|
|
|
9
12
|
class TopBarButtonsTest : BaseTest() {
|
|
13
|
+
private final var ACCESSIBILITY_LABEL_AS_DEFAUL_OPTIONS: String = "accessibilityLabel as default option"
|
|
14
|
+
private final var ACCESSIBILITY_LABEL_AS_CUSTOM_OPTIONS: String = "My accessibilityLabel explicitly given"
|
|
15
|
+
private final var OTHER_ACCESSIBILITY_LABEL: String = "Other accessibilityLabel"
|
|
10
16
|
private lateinit var uut: TopBarButtons
|
|
17
|
+
private var activity: Activity? = null
|
|
11
18
|
|
|
12
19
|
override fun beforeEach() {
|
|
13
20
|
uut = TopBarButtons()
|
|
21
|
+
activity = newActivity()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
fun createBackButtonJson(label: String?): JSONObject {
|
|
25
|
+
return JSONObject().put("accessibilityLabel", label);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
fun createTopBarOptionsJson(label: String?): JSONObject {
|
|
29
|
+
return JSONObject().put("backButton", createBackButtonJson(label))
|
|
14
30
|
}
|
|
15
31
|
|
|
16
32
|
@Test
|
|
@@ -22,4 +38,58 @@ class TopBarButtonsTest : BaseTest() {
|
|
|
22
38
|
assertThat(uut.right).hasSize(2)
|
|
23
39
|
right.forEachIndexed { index, buttonOptions -> assertThat(buttonOptions).isNotEqualTo(uut.right!![index]) }
|
|
24
40
|
}
|
|
41
|
+
|
|
42
|
+
@Test
|
|
43
|
+
fun mergeWithDefault_dontOverrideCustomAccessibilityLabel() {
|
|
44
|
+
val default: TopBarButtons = TopBarButtons.parse(activity, createTopBarOptionsJson(ACCESSIBILITY_LABEL_AS_DEFAUL_OPTIONS))
|
|
45
|
+
val current: TopBarButtons = TopBarButtons.parse(activity, createTopBarOptionsJson(ACCESSIBILITY_LABEL_AS_CUSTOM_OPTIONS))
|
|
46
|
+
|
|
47
|
+
current.mergeWithDefault(default)
|
|
48
|
+
assertThat(current.back.accessibilityLabel.get()).isEqualTo(ACCESSIBILITY_LABEL_AS_CUSTOM_OPTIONS)
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@Test
|
|
52
|
+
fun mergeWithDefault_overrideDefaultAccessibilityLabel() {
|
|
53
|
+
val default: TopBarButtons = TopBarButtons.parse(activity, createTopBarOptionsJson(ACCESSIBILITY_LABEL_AS_DEFAUL_OPTIONS))
|
|
54
|
+
val current: TopBarButtons = TopBarButtons.parse(activity, createTopBarOptionsJson(BackButton.DEFAULT_ACCESSIBILITY_LABEL))
|
|
55
|
+
|
|
56
|
+
current.mergeWithDefault(default)
|
|
57
|
+
assertThat(current.back.accessibilityLabel.get()).isEqualTo(ACCESSIBILITY_LABEL_AS_DEFAUL_OPTIONS)
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@Test
|
|
61
|
+
fun mergeWithDefault_overrideEmptyAccessibilityLabel() {
|
|
62
|
+
val default: TopBarButtons = TopBarButtons.parse(activity, createTopBarOptionsJson(ACCESSIBILITY_LABEL_AS_DEFAUL_OPTIONS))
|
|
63
|
+
val current: TopBarButtons = TopBarButtons.parse(activity, createTopBarOptionsJson(null))
|
|
64
|
+
|
|
65
|
+
current.mergeWithDefault(default)
|
|
66
|
+
assertThat(current.back.accessibilityLabel.get()).isEqualTo(ACCESSIBILITY_LABEL_AS_DEFAUL_OPTIONS)
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@Test
|
|
70
|
+
fun mergeWith_dontOverrideCurrentAccessibilityLabelWhenPassEmptyValue() {
|
|
71
|
+
val current: TopBarButtons = TopBarButtons.parse(activity, createTopBarOptionsJson(ACCESSIBILITY_LABEL_AS_CUSTOM_OPTIONS))
|
|
72
|
+
val other: TopBarButtons = TopBarButtons.parse(activity, createTopBarOptionsJson(null))
|
|
73
|
+
|
|
74
|
+
current.mergeWith(other)
|
|
75
|
+
assertThat(current.back.accessibilityLabel.get()).isEqualTo(ACCESSIBILITY_LABEL_AS_CUSTOM_OPTIONS)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
@Test
|
|
79
|
+
fun mergeWith_dontOverrideCurrentAccessibilityLabelWhenPassDefaultValue() {
|
|
80
|
+
val current: TopBarButtons = TopBarButtons.parse(activity, createTopBarOptionsJson(ACCESSIBILITY_LABEL_AS_CUSTOM_OPTIONS))
|
|
81
|
+
val other: TopBarButtons = TopBarButtons.parse(activity, createTopBarOptionsJson(BackButton.DEFAULT_ACCESSIBILITY_LABEL))
|
|
82
|
+
|
|
83
|
+
current.mergeWith(other)
|
|
84
|
+
assertThat(current.back.accessibilityLabel.get()).isEqualTo(ACCESSIBILITY_LABEL_AS_CUSTOM_OPTIONS)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
@Test
|
|
88
|
+
fun mergeWith_overridePreviousAccessibilityLabelWithNewValue() {
|
|
89
|
+
val current: TopBarButtons = TopBarButtons.parse(activity, createTopBarOptionsJson(ACCESSIBILITY_LABEL_AS_CUSTOM_OPTIONS))
|
|
90
|
+
val other: TopBarButtons = TopBarButtons.parse(activity, createTopBarOptionsJson(OTHER_ACCESSIBILITY_LABEL))
|
|
91
|
+
|
|
92
|
+
current.mergeWith(other)
|
|
93
|
+
assertThat(current.back.accessibilityLabel.get()).isEqualTo(OTHER_ACCESSIBILITY_LABEL)
|
|
94
|
+
}
|
|
25
95
|
}
|
package/lib/android/app/src/test/java/com/reactnativenavigation/options/parsers/ColorParseTest.java
CHANGED
|
@@ -6,7 +6,6 @@ import com.facebook.react.bridge.JavaOnlyMap;
|
|
|
6
6
|
import com.reactnativenavigation.BaseTest;
|
|
7
7
|
import com.reactnativenavigation.options.params.DontApplyColour;
|
|
8
8
|
import com.reactnativenavigation.options.params.ReactPlatformColor;
|
|
9
|
-
import com.reactnativenavigation.utils.StatusBarUtils;
|
|
10
9
|
|
|
11
10
|
import org.json.JSONArray;
|
|
12
11
|
import org.json.JSONException;
|
|
@@ -16,7 +15,6 @@ import org.mockito.MockedStatic;
|
|
|
16
15
|
import org.mockito.Mockito;
|
|
17
16
|
|
|
18
17
|
import static org.assertj.core.api.Java6Assertions.assertThat;
|
|
19
|
-
import static org.mockito.ArgumentMatchers.any;
|
|
20
18
|
|
|
21
19
|
import android.app.Activity;
|
|
22
20
|
|
|
@@ -38,7 +36,6 @@ public class ColorParseTest extends BaseTest {
|
|
|
38
36
|
|
|
39
37
|
@Test
|
|
40
38
|
public void shouldParsePlatformColors() throws JSONException {
|
|
41
|
-
JSONObject json = new JSONObject();
|
|
42
39
|
JSONObject color = new JSONObject();
|
|
43
40
|
final JSONArray jsonArray = new JSONArray();
|
|
44
41
|
jsonArray.put("@color/colorPrimary");
|
package/lib/android/app/src/test/java/com/reactnativenavigation/presentation/RenderCheckerTest.java
CHANGED
|
@@ -25,7 +25,7 @@ public class RenderCheckerTest extends BaseTest {
|
|
|
25
25
|
|
|
26
26
|
@Test
|
|
27
27
|
public void areRendered() {
|
|
28
|
-
Collection<ViewController
|
|
28
|
+
Collection<ViewController<?>> items = Arrays.asList(
|
|
29
29
|
renderedComponent(),
|
|
30
30
|
renderedComponent(),
|
|
31
31
|
renderedComponent()
|
|
@@ -36,7 +36,7 @@ public class RenderCheckerTest extends BaseTest {
|
|
|
36
36
|
|
|
37
37
|
@Test
|
|
38
38
|
public void areRendered_reduce() {
|
|
39
|
-
Collection<ViewController
|
|
39
|
+
Collection<ViewController<?>> items = Arrays.asList(
|
|
40
40
|
renderedComponent(),
|
|
41
41
|
notRenderedComponent(),
|
|
42
42
|
renderedComponent()
|
|
@@ -45,14 +45,14 @@ public class RenderCheckerTest extends BaseTest {
|
|
|
45
45
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
private ViewController renderedComponent() {
|
|
49
|
-
ViewController mock = Mockito.mock(ViewController.class);
|
|
48
|
+
private ViewController<?> renderedComponent() {
|
|
49
|
+
ViewController<?> mock = Mockito.mock(ViewController.class);
|
|
50
50
|
when(mock.isRendered()).then(__ -> true);
|
|
51
51
|
return mock;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
private ViewController notRenderedComponent() {
|
|
55
|
-
ViewController mock = Mockito.mock(ViewController.class);
|
|
54
|
+
private ViewController<?> notRenderedComponent() {
|
|
55
|
+
ViewController<?> mock = Mockito.mock(ViewController.class);
|
|
56
56
|
when(mock.isRendered()).then(__ -> false);
|
|
57
57
|
return mock;
|
|
58
58
|
}
|
|
@@ -12,7 +12,6 @@ import com.reactnativenavigation.mocks.TypefaceLoaderMock;
|
|
|
12
12
|
import com.reactnativenavigation.options.Options;
|
|
13
13
|
import com.reactnativenavigation.options.params.Colour;
|
|
14
14
|
import com.reactnativenavigation.options.params.DontApplyColour;
|
|
15
|
-
import com.reactnativenavigation.options.params.NullColor;
|
|
16
15
|
import com.reactnativenavigation.options.params.NullText;
|
|
17
16
|
import com.reactnativenavigation.options.params.NullThemeColour;
|
|
18
17
|
import com.reactnativenavigation.options.params.ThemeColour;
|
|
@@ -47,9 +46,9 @@ public class BottomTabPresenterTest extends BaseTest {
|
|
|
47
46
|
private BottomTabPresenter uut;
|
|
48
47
|
private BottomTabs bottomTabs;
|
|
49
48
|
private List<ViewController<?>> tabs;
|
|
50
|
-
private ViewController child1;
|
|
51
|
-
private ViewController child2;
|
|
52
|
-
private ViewController child3;
|
|
49
|
+
private ViewController<?> child1;
|
|
50
|
+
private ViewController<?> child2;
|
|
51
|
+
private ViewController<?> child3;
|
|
53
52
|
private Activity activity;
|
|
54
53
|
private ChildControllersRegistry childRegistry;
|
|
55
54
|
|
|
@@ -49,7 +49,7 @@ public class BottomTabsAttacherTest extends BaseTest {
|
|
|
49
49
|
|
|
50
50
|
@Test
|
|
51
51
|
public void onTabSelected() {
|
|
52
|
-
ViewController tab = mock(ViewController.class);
|
|
52
|
+
ViewController<?> tab = mock(ViewController.class);
|
|
53
53
|
uut.onTabSelected(tab);
|
|
54
54
|
verify(mode).onTabSelected(tab);
|
|
55
55
|
}
|
|
@@ -36,7 +36,6 @@ import com.reactnativenavigation.views.bottomtabs.BottomTabs;
|
|
|
36
36
|
import com.reactnativenavigation.views.bottomtabs.BottomTabsContainer;
|
|
37
37
|
import com.reactnativenavigation.views.bottomtabs.BottomTabsLayout;
|
|
38
38
|
|
|
39
|
-
import org.jetbrains.annotations.NotNull;
|
|
40
39
|
import org.junit.Test;
|
|
41
40
|
import org.mockito.ArgumentCaptor;
|
|
42
41
|
import org.mockito.Mockito;
|
|
@@ -50,7 +49,6 @@ import androidx.annotation.NonNull;
|
|
|
50
49
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
51
50
|
|
|
52
51
|
|
|
53
|
-
import static com.nhaarman.mockitokotlin2.OngoingStubbingKt.whenever;
|
|
54
52
|
import static com.reactnativenavigation.TestUtils.hideBackButton;
|
|
55
53
|
import static com.reactnativenavigation.utils.ObjectUtils.perform;
|
|
56
54
|
import static org.assertj.core.api.Java6Assertions.assertThat;
|
|
@@ -68,12 +66,12 @@ public class BottomTabsControllerTest extends BaseTest {
|
|
|
68
66
|
private BottomTabsContainer bottomTabsContainer;
|
|
69
67
|
private BottomTabsController uut;
|
|
70
68
|
private final Options initialOptions = new Options();
|
|
71
|
-
private ViewController child1;
|
|
72
|
-
private ViewController child2;
|
|
73
|
-
private ViewController child3;
|
|
74
|
-
private ViewController stackChild;
|
|
69
|
+
private ViewController<?> child1;
|
|
70
|
+
private ViewController<?> child2;
|
|
71
|
+
private ViewController<?> child3;
|
|
72
|
+
private ViewController<?> stackChild;
|
|
75
73
|
private StackController child4;
|
|
76
|
-
private ViewController child5;
|
|
74
|
+
private ViewController<?> child5;
|
|
77
75
|
private final Options tabOptions = OptionHelper.createBottomTabOptions();
|
|
78
76
|
private final ImageLoader imageLoaderMock = ImageLoaderMock.mock();
|
|
79
77
|
private EventEmitter eventEmitter;
|
|
@@ -125,7 +123,7 @@ public class BottomTabsControllerTest extends BaseTest {
|
|
|
125
123
|
@Test
|
|
126
124
|
public void parentControllerIsSet() {
|
|
127
125
|
uut = createBottomTabs();
|
|
128
|
-
for (ViewController tab : tabs) {
|
|
126
|
+
for (ViewController<?> tab : tabs) {
|
|
129
127
|
assertThat(tab.getParentController()).isEqualTo(uut);
|
|
130
128
|
}
|
|
131
129
|
}
|
|
@@ -134,7 +132,7 @@ public class BottomTabsControllerTest extends BaseTest {
|
|
|
134
132
|
public void setTabs_allChildViewsAreAttachedToHierarchy() {
|
|
135
133
|
uut.onViewWillAppear();
|
|
136
134
|
assertThat(uut.getView().getChildCount()).isEqualTo(6);
|
|
137
|
-
for (ViewController child : uut.getChildControllers()) {
|
|
135
|
+
for (ViewController<?> child : uut.getChildControllers()) {
|
|
138
136
|
assertThat(child.getView().getParent()).isNotNull();
|
|
139
137
|
}
|
|
140
138
|
}
|
|
@@ -152,13 +150,13 @@ public class BottomTabsControllerTest extends BaseTest {
|
|
|
152
150
|
public void onTabSelected() {
|
|
153
151
|
uut.ensureViewIsCreated();
|
|
154
152
|
assertThat(uut.getSelectedIndex()).isZero();
|
|
155
|
-
assertThat(((ViewController) ((List) uut.getChildControllers()).get(0)).getView().getVisibility()).isEqualTo(View.VISIBLE);
|
|
153
|
+
assertThat(((ViewController<?>) ((List<?>) uut.getChildControllers()).get(0)).getView().getVisibility()).isEqualTo(View.VISIBLE);
|
|
156
154
|
|
|
157
155
|
uut.onTabSelected(3, false);
|
|
158
156
|
|
|
159
157
|
assertThat(uut.getSelectedIndex()).isEqualTo(3);
|
|
160
|
-
assertThat(((ViewController) ((List) uut.getChildControllers()).get(0)).getView().getVisibility()).isEqualTo(View.INVISIBLE);
|
|
161
|
-
assertThat(((ViewController) ((List) uut.getChildControllers()).get(3)).getView().getVisibility()).isEqualTo(View.VISIBLE);
|
|
158
|
+
assertThat(((ViewController<?>) ((List<?>) uut.getChildControllers()).get(0)).getView().getVisibility()).isEqualTo(View.INVISIBLE);
|
|
159
|
+
assertThat(((ViewController<?>) ((List<?>) uut.getChildControllers()).get(3)).getView().getVisibility()).isEqualTo(View.VISIBLE);
|
|
162
160
|
verify(eventEmitter).emitBottomTabSelected(0, 3);
|
|
163
161
|
}
|
|
164
162
|
|
|
@@ -170,7 +168,7 @@ public class BottomTabsControllerTest extends BaseTest {
|
|
|
170
168
|
uut.onTabSelected(0, true);
|
|
171
169
|
|
|
172
170
|
assertThat(uut.getSelectedIndex()).isEqualTo(0);
|
|
173
|
-
assertThat(((ViewController) ((List) uut.getChildControllers()).get(0)).getView().getParent()).isNotNull();
|
|
171
|
+
assertThat(((ViewController<?>) ((List<?>) uut.getChildControllers()).get(0)).getView().getParent()).isNotNull();
|
|
174
172
|
verify(eventEmitter).emitBottomTabSelected(0, 0);
|
|
175
173
|
}
|
|
176
174
|
|
|
@@ -185,7 +183,7 @@ public class BottomTabsControllerTest extends BaseTest {
|
|
|
185
183
|
|
|
186
184
|
@Test
|
|
187
185
|
public void applyChildOptions_bottomTabsOptionsAreClearedAfterApply() {
|
|
188
|
-
ParentController parent = Mockito.mock(ParentController.class);
|
|
186
|
+
ParentController<?> parent = Mockito.mock(ParentController.class);
|
|
189
187
|
uut.setParentController(parent);
|
|
190
188
|
|
|
191
189
|
child1.options.bottomTabsOptions.backgroundColor = new ThemeColour(new Colour(Color.RED));
|
|
@@ -456,7 +454,7 @@ public class BottomTabsControllerTest extends BaseTest {
|
|
|
456
454
|
when(child5.handleBack(any())).thenReturn(true);
|
|
457
455
|
}
|
|
458
456
|
|
|
459
|
-
private StackController spyOnStack(ViewController initialChild) {
|
|
457
|
+
private StackController spyOnStack(ViewController<?> initialChild) {
|
|
460
458
|
StackController build = TestUtils.newStackController(activity)
|
|
461
459
|
.setInitialOptions(tabOptions)
|
|
462
460
|
.build();
|
|
@@ -31,8 +31,8 @@ public abstract class AttachModeTest extends BaseTest {
|
|
|
31
31
|
private Activity activity;
|
|
32
32
|
private ChildControllersRegistry childRegistry;
|
|
33
33
|
protected ViewGroup parent;
|
|
34
|
-
ViewController tab1;
|
|
35
|
-
ViewController tab2;
|
|
34
|
+
ViewController<?> tab1;
|
|
35
|
+
ViewController<?> tab2;
|
|
36
36
|
List<ViewController<?>> tabs;
|
|
37
37
|
protected Options options;
|
|
38
38
|
protected BottomTabsPresenter presenter;
|
|
@@ -69,18 +69,18 @@ public abstract class AttachModeTest extends BaseTest {
|
|
|
69
69
|
forEach(otherTabs(), t -> assertThat(t.getView().getVisibility()).isEqualTo(View.INVISIBLE));
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
ViewController[] otherTabs() {
|
|
72
|
+
ViewController<?>[] otherTabs() {
|
|
73
73
|
return filter(tabs, t -> t != initialTab()).toArray(new ViewController[0]);
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
ViewController initialTab() {
|
|
76
|
+
ViewController<?> initialTab() {
|
|
77
77
|
return tabs.get(INITIAL_TAB);
|
|
78
78
|
}
|
|
79
79
|
|
|
80
80
|
private List<ViewController<?>> createTabs() {
|
|
81
81
|
tab1 = new SimpleViewController(activity, childRegistry, "child1", new Options());
|
|
82
82
|
tab2 = spy(new SimpleViewController(activity, childRegistry, "child2", new Options()));
|
|
83
|
-
ViewController tab3 = new SimpleViewController(activity, childRegistry, "child3", new Options());
|
|
83
|
+
ViewController<?> tab3 = new SimpleViewController(activity, childRegistry, "child3", new Options());
|
|
84
84
|
return Arrays.asList(tab1, tab2, tab3);
|
|
85
85
|
}
|
|
86
86
|
}
|
|
@@ -16,7 +16,7 @@ import static org.mockito.Mockito.verify;
|
|
|
16
16
|
|
|
17
17
|
public class ChildControllerTest extends BaseTest {
|
|
18
18
|
|
|
19
|
-
private ChildController uut;
|
|
19
|
+
private ChildController<?> uut;
|
|
20
20
|
private ChildControllersRegistry childRegistry;
|
|
21
21
|
private Presenter presenter;
|
|
22
22
|
private Options resolvedOptions = new Options();
|
|
@@ -31,7 +31,7 @@ public class ChildControllerTest extends BaseTest {
|
|
|
31
31
|
return resolvedOptions;
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
ParentController parent = Mockito.mock(ParentController.class);
|
|
34
|
+
ParentController<?> parent = Mockito.mock(ParentController.class);
|
|
35
35
|
uut.setParentController(parent);
|
|
36
36
|
}
|
|
37
37
|
|
|
@@ -15,8 +15,8 @@ import static org.mockito.Mockito.verify;
|
|
|
15
15
|
|
|
16
16
|
public class ChildControllersRegistryTest extends BaseTest {
|
|
17
17
|
private ChildControllersRegistry uut;
|
|
18
|
-
private ChildController child1;
|
|
19
|
-
private ChildController child2;
|
|
18
|
+
private ChildController<?> child1;
|
|
19
|
+
private ChildController<?> child2;
|
|
20
20
|
|
|
21
21
|
@Override
|
|
22
22
|
public void beforeEach() {
|
|
@@ -40,11 +40,11 @@ public class ModalPresenterTest extends BaseTest {
|
|
|
40
40
|
private static final String MODAL_ID_1 = "modalId1";
|
|
41
41
|
private static final String MODAL_ID_2 = "modalId2";
|
|
42
42
|
|
|
43
|
-
private ChildController modal1;
|
|
44
|
-
private ChildController modal2;
|
|
43
|
+
private ChildController<?> modal1;
|
|
44
|
+
private ChildController<?> modal2;
|
|
45
45
|
private ModalPresenter uut;
|
|
46
46
|
private ModalAnimator animator;
|
|
47
|
-
private ViewController root;
|
|
47
|
+
private ViewController<?> root;
|
|
48
48
|
private CoordinatorLayout modalsLayout;
|
|
49
49
|
|
|
50
50
|
|
|
@@ -285,7 +285,7 @@ public class ModalPresenterTest extends BaseTest {
|
|
|
285
285
|
public void dismissModal_successIsReportedBeforeViewIsDestroyed() {
|
|
286
286
|
disableModalAnimations(modal1);
|
|
287
287
|
CommandListenerAdapter listener = Mockito.mock(CommandListenerAdapter.class);
|
|
288
|
-
ViewController modal = spy(modal1);
|
|
288
|
+
ViewController<?> modal = spy(modal1);
|
|
289
289
|
InOrder inOrder = inOrder(listener, modal);
|
|
290
290
|
|
|
291
291
|
uut.showModal(modal, root, new CommandListenerAdapter());
|
|
@@ -40,16 +40,16 @@ public class ModalStackTest extends BaseTest {
|
|
|
40
40
|
private static final String MODAL_ID_4 = "modalId4";
|
|
41
41
|
|
|
42
42
|
private ModalStack uut;
|
|
43
|
-
private ViewController modal1;
|
|
44
|
-
private ViewController modal2;
|
|
45
|
-
private ViewController modal3;
|
|
46
|
-
private ViewController modal4;
|
|
43
|
+
private ViewController<?> modal1;
|
|
44
|
+
private ViewController<?> modal2;
|
|
45
|
+
private ViewController<?> modal3;
|
|
46
|
+
private ViewController<?> modal4;
|
|
47
47
|
private StackController stack;
|
|
48
48
|
private Activity activity;
|
|
49
49
|
private ChildControllersRegistry childRegistry;
|
|
50
50
|
private ModalPresenter presenter;
|
|
51
51
|
private ModalAnimator animator;
|
|
52
|
-
private ViewController root;
|
|
52
|
+
private ViewController<?> root;
|
|
53
53
|
private EventEmitter emitter;
|
|
54
54
|
|
|
55
55
|
@Override
|
|
@@ -308,7 +308,7 @@ public class ModalStackTest extends BaseTest {
|
|
|
308
308
|
|
|
309
309
|
@Test
|
|
310
310
|
public void handleBack_ViewControllerTakesPrecedenceOverModal() {
|
|
311
|
-
ViewController backHandlingModal = spy(new SimpleViewController(activity, childRegistry, "stack", new Options()){
|
|
311
|
+
ViewController<?> backHandlingModal = spy(new SimpleViewController(activity, childRegistry, "stack", new Options()){
|
|
312
312
|
@Override
|
|
313
313
|
public boolean handleBack(CommandListener listener) {
|
|
314
314
|
return true;
|
|
@@ -338,17 +338,17 @@ public class ModalStackTest extends BaseTest {
|
|
|
338
338
|
verify(modal2).destroy();
|
|
339
339
|
}
|
|
340
340
|
|
|
341
|
-
private ViewController findModal(String id) {
|
|
341
|
+
private ViewController<?> findModal(String id) {
|
|
342
342
|
return uut.findControllerById(id);
|
|
343
343
|
}
|
|
344
344
|
|
|
345
|
-
private void showModalsWithoutAnimation(ViewController
|
|
346
|
-
for (ViewController modal : modals) {
|
|
345
|
+
private void showModalsWithoutAnimation(ViewController<?>... modals) {
|
|
346
|
+
for (ViewController<?> modal : modals) {
|
|
347
347
|
showModalWithoutAnimation(modal);
|
|
348
348
|
}
|
|
349
349
|
}
|
|
350
350
|
|
|
351
|
-
private void showModalWithoutAnimation(ViewController modal) {
|
|
351
|
+
private void showModalWithoutAnimation(ViewController<?> modal) {
|
|
352
352
|
disableShowModalAnimation(modal);
|
|
353
353
|
uut.showModal(modal, root, new CommandListenerAdapter());
|
|
354
354
|
}
|