react-native-navigation 7.24.0 → 7.24.3-snapshot.492
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/lib/Mock/Components/ComponentScreen.tsx +1 -1
- package/lib/Mock/Components/NavigationButton.tsx +1 -1
- package/lib/Mock/Components/TopBar.tsx +6 -2
- package/lib/android/app/build.gradle +12 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/ReactView.java +13 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/SystemUiUtils.kt +3 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java +1 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewController.java +2 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenter.java +4 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +2 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabs.java +6 -0
- package/lib/dist/Mock/Components/ComponentScreen.js +2 -2
- package/lib/dist/Mock/Components/NavigationButton.d.ts +1 -1
- package/lib/dist/Mock/Components/NavigationButton.js +3 -3
- package/lib/dist/Mock/Components/TopBar.d.ts +1 -2
- package/lib/dist/Mock/Components/TopBar.js +3 -3
- package/lib/ios/RNNComponentRootView.m +0 -14
- package/package.json +1 -1
- package/.buildkite/pipeline.yml +0 -59
- package/lib/android/app/src/test/java/com/reactnativenavigation/BaseTest.java +0 -178
- package/lib/android/app/src/test/java/com/reactnativenavigation/EnvironmentTest.java +0 -43
- package/lib/android/app/src/test/java/com/reactnativenavigation/TestActivity.java +0 -23
- package/lib/android/app/src/test/java/com/reactnativenavigation/TestApplication.java +0 -35
- package/lib/android/app/src/test/java/com/reactnativenavigation/TestUtils.java +0 -62
- package/lib/android/app/src/test/java/com/reactnativenavigation/fakes/IconResolverFake.kt +0 -8
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/BackDrawable.java +0 -30
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/ImageLoaderMock.kt +0 -49
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/Mocks.kt +0 -18
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/SimpleComponentViewController.java +0 -15
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/SimpleOverlay.java +0 -54
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/SimpleViewController.java +0 -113
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentLayout.java +0 -79
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestComponentViewCreator.java +0 -18
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/TestReactView.java +0 -71
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/TitleBarButtonCreatorMock.java +0 -34
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/TitleBarReactViewCreatorMock.java +0 -20
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/TopBarBackgroundViewCreatorMock.java +0 -20
- package/lib/android/app/src/test/java/com/reactnativenavigation/mocks/TypefaceLoaderMock.kt +0 -21
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/LayoutNodeParserTest.java +0 -51
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/OptionsTest.java +0 -315
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/OrientationOptionsTest.java +0 -81
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/TopBarButtonsTest.kt +0 -95
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/TransitionAnimationOptionsTest.kt +0 -122
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/parsers/BoolParserTest.java +0 -28
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/parsers/ColorParseTest.java +0 -50
- package/lib/android/app/src/test/java/com/reactnativenavigation/options/parsers/JSONParserTest.java +0 -64
- package/lib/android/app/src/test/java/com/reactnativenavigation/presentation/PresenterTest.java +0 -56
- package/lib/android/app/src/test/java/com/reactnativenavigation/presentation/RenderCheckerTest.java +0 -59
- package/lib/android/app/src/test/java/com/reactnativenavigation/presentation/SideMenuPresenterTest.java +0 -35
- package/lib/android/app/src/test/java/com/reactnativenavigation/react/NavigationModuleTest.java +0 -102
- package/lib/android/app/src/test/java/com/reactnativenavigation/react/ReloadListenerTest.java +0 -24
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/AnimationHelper.kt +0 -33
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/ButtonPresenterTest.java +0 -241
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/ButtonSpanTest.java +0 -57
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/CompatUtilsTest.java +0 -17
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/LayoutFactoryTest.java +0 -78
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/MotionEventTest.kt +0 -47
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/NativeCommandListenerTest.java +0 -60
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/OptionHelper.java +0 -16
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/ReflectionUtilsTest.java +0 -26
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/StringUtilsTest.java +0 -19
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/TitleAndButtonsMeasurerTest.kt +0 -357
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/TitleBarHelper.java +0 -54
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/UiThreadTest.java +0 -29
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/UiUtilsTest.java +0 -22
- package/lib/android/app/src/test/java/com/reactnativenavigation/utils/ViewHelper.java +0 -9
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/OptionsApplyingTest.java +0 -149
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabPresenterTest.java +0 -206
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsAttacherTest.java +0 -62
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsControllerTest.kt +0 -572
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsPresenterTest.kt +0 -173
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/modes/AfterInitialTabTest.java +0 -38
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/modes/AttachModeTest.java +0 -86
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/modes/OnSwitchToTabTest.java +0 -31
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/bottomtabs/attacher/modes/TogetherTest.java +0 -20
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/button/NavigationIconResolverTest.java +0 -78
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/child/ChildControllerTest.java +0 -80
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/child/ChildControllersRegistryTest.java +0 -56
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewControllerTest.java +0 -191
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/externalcomponent/ExternalComponentViewControllerTest.java +0 -97
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/externalcomponent/FragmentCreatorMock.java +0 -34
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/externalcomponent/SomeFragment.java +0 -8
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/fakes/FakeParentController.kt +0 -33
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalAnimatorMock.java +0 -40
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalAnimatorTest.kt +0 -213
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalPresenterTest.java +0 -319
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/modal/ModalStackTest.java +0 -368
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/NavigatorTest.java +0 -898
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/navigator/RootPresenterTest.kt +0 -254
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/overlay/OverlayManagerTest.java +0 -108
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/parent/ParentControllerTest.java +0 -299
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuControllerTest.java +0 -446
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/BackButtonHelperTest.java +0 -77
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/FloatingActionButtonTest.java +0 -154
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/IdStackTest.java +0 -114
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackAnimatorTest.kt +0 -241
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.kt +0 -1165
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenterTest.kt +0 -1081
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TitleBarButtonControllerTest.java +0 -61
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TitleBarReactViewControllerTest.java +0 -43
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TopBarButtonControllerTest.java +0 -120
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/TopBarControllerTest.kt +0 -432
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/toptabs/TopTabsViewControllerTest.java +0 -247
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/viewcontroller/ViewControllerTest.java +0 -337
- package/lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxDelegateTest.java +0 -68
- package/lib/android/app/src/test/java/com/reactnativenavigation/views/OverlayTouchDelegateTest.java +0 -60
- package/lib/android/app/src/test/java/com/reactnativenavigation/views/TitleAndButtonsContainerTest.kt +0 -477
- package/lib/android/app/src/test/java/com/reactnativenavigation/views/TopBarTest.java +0 -82
- package/lib/android/app/src/test/java/com/reactnativenavigation/views/animations/BaseViewAnimatorTest.kt +0 -109
- package/lib/android/app/src/test/java/com/reactnativenavigation/views/animations/DefaultViewAnimatorCreatorFake.kt +0 -36
- package/lib/android/app/src/test/java/com/reactnativenavigation/views/bottomtabs/BottomTabsContainerTest.kt +0 -101
- package/lib/android/app/src/test/java/com/reactnativenavigation/views/bottomtabs/BottomTabsTest.kt +0 -40
- package/lib/android/app/src/test/resources/mockito-extensions/org.mockito.plugins.MockMaker +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { Button, View, Text } from 'react-native';
|
|
3
|
-
import { Navigation } from '
|
|
3
|
+
import { Navigation } from 'react-native-navigation';
|
|
4
4
|
import { ComponentProps } from '../ComponentProps';
|
|
5
5
|
import { VISIBLE_SCREEN_TEST_ID } from '../constants';
|
|
6
6
|
import { LayoutStore } from '../Stores/LayoutStore';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { Button, TouchableOpacity } from 'react-native';
|
|
3
|
-
import { Navigation, OptionsTopBarButton } from '
|
|
3
|
+
import { Navigation, OptionsTopBarButton } from 'react-native-navigation';
|
|
4
4
|
import { events } from '../Stores/EventsStore';
|
|
5
5
|
|
|
6
6
|
interface ButtonProps {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
2
|
import { Button, View, Text } from 'react-native';
|
|
3
|
-
import {
|
|
4
|
-
|
|
3
|
+
import {
|
|
4
|
+
Navigation,
|
|
5
|
+
OptionsTopBar,
|
|
6
|
+
OptionsTopBarBackButton,
|
|
7
|
+
OptionsTopBarButton,
|
|
8
|
+
} from 'react-native-navigation';
|
|
5
9
|
import ParentNode from '../Layouts/ParentNode';
|
|
6
10
|
import { LayoutStore } from '../Stores/LayoutStore';
|
|
7
11
|
import { NavigationButton } from './NavigationButton';
|
|
@@ -172,6 +172,7 @@ allprojects { p ->
|
|
|
172
172
|
}
|
|
173
173
|
|
|
174
174
|
dependencies {
|
|
175
|
+
|
|
175
176
|
implementation "androidx.core:core-ktx:1.6.0"
|
|
176
177
|
implementation "org.jetbrains.kotlin:$kotlinStdlib:$kotlinVersion"
|
|
177
178
|
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-android:$kotlinCoroutinesCore"
|
|
@@ -189,13 +190,15 @@ dependencies {
|
|
|
189
190
|
//noinspection GradleDynamicVersion
|
|
190
191
|
implementation 'com.facebook.react:react-native:+'
|
|
191
192
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
193
|
+
if("Playground".toLowerCase() == rootProject.name.toLowerCase()){
|
|
194
|
+
// tests only for our playground
|
|
195
|
+
testImplementation 'junit:junit:4.13.2'
|
|
196
|
+
testImplementation "org.robolectric:robolectric:4.7.2"
|
|
197
|
+
testImplementation 'org.assertj:assertj-core:3.11.1'
|
|
198
|
+
testImplementation 'org.mockito:mockito-core:4.0.0'
|
|
199
|
+
testImplementation 'com.squareup.assertj:assertj-android:1.2.0'
|
|
200
|
+
testImplementation 'org.mockito:mockito-inline:3.4.0'
|
|
201
|
+
testImplementation "org.mockito.kotlin:mockito-kotlin:4.0.0"
|
|
202
|
+
testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlinVersion"
|
|
203
|
+
}
|
|
201
204
|
}
|
|
@@ -66,18 +66,22 @@ public class ReactView extends ReactRootView implements IReactView, Renderable {
|
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
public void sendComponentWillStart(ComponentType type) {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
69
|
+
this.post(()->{
|
|
70
|
+
if (this.reactInstanceManager == null) return;
|
|
71
|
+
ReactContext currentReactContext = reactInstanceManager.getCurrentReactContext();
|
|
72
|
+
if (currentReactContext != null)
|
|
73
|
+
new EventEmitter(currentReactContext).emitComponentWillAppear(componentId, componentName, type);
|
|
74
|
+
});
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
public void sendComponentStart(ComponentType type) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
this.post(()->{
|
|
79
|
+
if (this.reactInstanceManager == null) return;
|
|
80
|
+
ReactContext currentReactContext = reactInstanceManager.getCurrentReactContext();
|
|
81
|
+
if (currentReactContext != null) {
|
|
82
|
+
new EventEmitter(currentReactContext).emitComponentDidAppear(componentId, componentName, type);
|
|
83
|
+
}
|
|
84
|
+
});
|
|
81
85
|
}
|
|
82
86
|
|
|
83
87
|
public void sendComponentStop(ComponentType type) {
|
|
@@ -17,7 +17,7 @@ import kotlin.math.ceil
|
|
|
17
17
|
object SystemUiUtils {
|
|
18
18
|
private const val STATUS_BAR_HEIGHT_M = 24
|
|
19
19
|
private const val STATUS_BAR_HEIGHT_L = 25
|
|
20
|
-
|
|
20
|
+
internal const val STATUS_BAR_HEIGHT_TRANSLUCENCY = 0.65f
|
|
21
21
|
private var statusBarHeight = -1
|
|
22
22
|
var navigationBarDefaultColor = -1
|
|
23
23
|
private set
|
|
@@ -124,7 +124,8 @@ object SystemUiUtils {
|
|
|
124
124
|
val opaqueColor = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
|
125
125
|
Color.BLACK
|
|
126
126
|
}else{
|
|
127
|
-
val
|
|
127
|
+
val colorAlpha = Color.alpha(color)
|
|
128
|
+
val alpha = if (translucent && colorAlpha == 255) STATUS_BAR_HEIGHT_TRANSLUCENCY else colorAlpha/255.0f
|
|
128
129
|
val red: Int = Color.red(color)
|
|
129
130
|
val green: Int = Color.green(color)
|
|
130
131
|
val blue: Int = Color.blue(color)
|
|
@@ -274,6 +274,7 @@ public class BottomTabsController extends ParentController<BottomTabsLayout> imp
|
|
|
274
274
|
getCurrentView().setVisibility(View.INVISIBLE);
|
|
275
275
|
bottomTabs.setCurrentItem(newIndex, false);
|
|
276
276
|
getCurrentView().setVisibility(View.VISIBLE);
|
|
277
|
+
getCurrentChild().onViewWillAppear();
|
|
277
278
|
getCurrentChild().onViewDidAppear();
|
|
278
279
|
}
|
|
279
280
|
|
|
@@ -78,12 +78,14 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
78
78
|
if (view != null)
|
|
79
79
|
view.sendComponentWillStart();
|
|
80
80
|
super.onViewDidAppear();
|
|
81
|
+
view.requestApplyInsets();
|
|
81
82
|
if (view != null && lastVisibilityState == VisibilityState.Disappear) view.sendComponentStart();
|
|
82
83
|
lastVisibilityState = VisibilityState.Appear;
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
@Override
|
|
86
87
|
public void onViewDisappear() {
|
|
88
|
+
if(lastVisibilityState == VisibilityState.Disappear)return;
|
|
87
89
|
lastVisibilityState = VisibilityState.Disappear;
|
|
88
90
|
if (view != null) view.sendComponentStop();
|
|
89
91
|
super.onViewDisappear();
|
|
@@ -90,12 +90,10 @@ public class ModalPresenter {
|
|
|
90
90
|
}
|
|
91
91
|
|
|
92
92
|
private void onShowModalEnd(ViewController<?> toAdd, @Nullable ViewController<?> toRemove, CommandListener listener) {
|
|
93
|
-
toAdd.
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
98
|
-
});
|
|
93
|
+
toAdd.onViewDidAppear();
|
|
94
|
+
if (toRemove != null && toAdd.resolveCurrentOptions(defaultOptions).modal.presentationStyle != ModalPresentationStyle.OverCurrentContext) {
|
|
95
|
+
toRemove.detachView();
|
|
96
|
+
}
|
|
99
97
|
listener.onSuccess(toAdd.getId());
|
|
100
98
|
}
|
|
101
99
|
|
|
@@ -190,10 +190,8 @@ public class StackController extends ParentController<StackLayout> {
|
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
private void onPushAnimationComplete(ViewController<?> toAdd, ViewController<?> toRemove, CommandListener listener) {
|
|
193
|
-
toAdd.
|
|
194
|
-
|
|
195
|
-
if (!peek().equals(toRemove)) getView().removeView(toRemove.getView());
|
|
196
|
-
});
|
|
193
|
+
toAdd.onViewDidAppear();
|
|
194
|
+
if (!peek().equals(toRemove)) getView().removeView(toRemove.getView());
|
|
197
195
|
listener.onSuccess(toAdd.getId());
|
|
198
196
|
}
|
|
199
197
|
|
package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabs.java
CHANGED
|
@@ -88,6 +88,12 @@ public class BottomTabs extends AHBottomNavigation {
|
|
|
88
88
|
if (getDefaultBackgroundColor() != color) setDefaultBackgroundColor(color);
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
@Override
|
|
92
|
+
public void restoreBottomNavigation(boolean withAnimation) {
|
|
93
|
+
super.restoreBottomNavigation(withAnimation);
|
|
94
|
+
if (!withAnimation) setVisibility(View.VISIBLE);
|
|
95
|
+
}
|
|
96
|
+
|
|
91
97
|
@Override
|
|
92
98
|
public void hideBottomNavigation(boolean withAnimation) {
|
|
93
99
|
super.hideBottomNavigation(withAnimation);
|
|
@@ -4,7 +4,7 @@ exports.ComponentScreen = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
|
-
const
|
|
7
|
+
const react_native_navigation_1 = require("react-native-navigation");
|
|
8
8
|
const constants_1 = require("../constants");
|
|
9
9
|
const LayoutStore_1 = require("../Stores/LayoutStore");
|
|
10
10
|
const connect_1 = require("../connect");
|
|
@@ -43,7 +43,7 @@ exports.ComponentScreen = (0, connect_1.connect)(class extends react_1.Component
|
|
|
43
43
|
return react_1.default.createElement(react_native_1.View, { testID: bottomTabsOptions?.testID }, buttons);
|
|
44
44
|
}
|
|
45
45
|
render() {
|
|
46
|
-
const Component =
|
|
46
|
+
const Component = react_native_navigation_1.Navigation.mock.store.getWrappedComponent(this.props.layoutNode.data.name);
|
|
47
47
|
if (!Component)
|
|
48
48
|
throw new Error(`${this.props.layoutNode.data.name} has not been registered.`);
|
|
49
49
|
return (react_1.default.createElement(react_native_1.View, { testID: this.isVisible() ? constants_1.VISIBLE_SCREEN_TEST_ID : undefined },
|
|
@@ -4,7 +4,7 @@ exports.NavigationButton = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
|
-
const
|
|
7
|
+
const react_native_navigation_1 = require("react-native-navigation");
|
|
8
8
|
const EventsStore_1 = require("../Stores/EventsStore");
|
|
9
9
|
const NavigationButton = class extends react_1.Component {
|
|
10
10
|
ref = undefined;
|
|
@@ -23,8 +23,8 @@ const NavigationButton = class extends react_1.Component {
|
|
|
23
23
|
//@ts-ignore
|
|
24
24
|
const buttonComponentId = button.component.componentId;
|
|
25
25
|
//@ts-ignore
|
|
26
|
-
const Component =
|
|
27
|
-
const props =
|
|
26
|
+
const Component = react_native_navigation_1.Navigation.mock.store.getComponentClassForName(button.component.name)();
|
|
27
|
+
const props = react_native_navigation_1.Navigation.mock.store.getPropsForId(buttonComponentId);
|
|
28
28
|
return (react_1.default.createElement(react_native_1.TouchableOpacity, { onPress: () => {
|
|
29
29
|
if (this.ref) {
|
|
30
30
|
// @ts-ignore
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { OptionsTopBarButton } from '
|
|
3
|
-
import { OptionsTopBar, OptionsTopBarBackButton } from '../../src/interfaces/Options';
|
|
2
|
+
import { OptionsTopBar, OptionsTopBarBackButton, OptionsTopBarButton } from 'react-native-navigation';
|
|
4
3
|
import ParentNode from '../Layouts/ParentNode';
|
|
5
4
|
export interface TopBarProps {
|
|
6
5
|
layoutNode: ParentNode;
|
|
@@ -4,7 +4,7 @@ exports.TopBar = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const react_1 = (0, tslib_1.__importStar)(require("react"));
|
|
6
6
|
const react_native_1 = require("react-native");
|
|
7
|
-
const
|
|
7
|
+
const react_native_navigation_1 = require("react-native-navigation");
|
|
8
8
|
const LayoutStore_1 = require("../Stores/LayoutStore");
|
|
9
9
|
const NavigationButton_1 = require("./NavigationButton");
|
|
10
10
|
const EventsStore_1 = require("../Stores/EventsStore");
|
|
@@ -54,8 +54,8 @@ const TopBar = class extends react_1.Component {
|
|
|
54
54
|
} }));
|
|
55
55
|
}
|
|
56
56
|
renderComponent(id, name, testID) {
|
|
57
|
-
const Component =
|
|
58
|
-
const props =
|
|
57
|
+
const Component = react_native_navigation_1.Navigation.mock.store.getComponentClassForName(name)();
|
|
58
|
+
const props = react_native_navigation_1.Navigation.mock.store.getPropsForId(id);
|
|
59
59
|
return (react_1.default.createElement(react_native_1.View, { key: id, testID: testID },
|
|
60
60
|
react_1.default.createElement(Component, { ...props, componentId: id })));
|
|
61
61
|
}
|
|
@@ -2,20 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
@implementation RNNComponentRootView
|
|
4
4
|
|
|
5
|
-
- (instancetype)initWithBridge:(RCTBridge *)bridge
|
|
6
|
-
moduleName:(NSString *)moduleName
|
|
7
|
-
initialProperties:(NSDictionary *)initialProperties
|
|
8
|
-
eventEmitter:(RNNEventEmitter *)eventEmitter
|
|
9
|
-
reactViewReadyBlock:(RNNReactViewReadyCompletionBlock)reactViewReadyBlock {
|
|
10
|
-
self = [super initWithBridge:bridge
|
|
11
|
-
moduleName:moduleName
|
|
12
|
-
initialProperties:initialProperties
|
|
13
|
-
eventEmitter:eventEmitter
|
|
14
|
-
reactViewReadyBlock:reactViewReadyBlock];
|
|
15
|
-
[bridge.uiManager setAvailableSize:UIScreen.mainScreen.bounds.size forRootView:self];
|
|
16
|
-
return self;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
5
|
- (NSString *)componentType {
|
|
20
6
|
return ComponentTypeScreen;
|
|
21
7
|
}
|
package/package.json
CHANGED
package/.buildkite/pipeline.yml
DELETED
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
steps:
|
|
2
|
-
- block: ":rocket: Release!"
|
|
3
|
-
prompt: "Fill out the details for release"
|
|
4
|
-
if: 'build.message =~ /^release\$/i'
|
|
5
|
-
fields:
|
|
6
|
-
- text: "VERSION"
|
|
7
|
-
key: "version"
|
|
8
|
-
- text: "NPM_TAG"
|
|
9
|
-
key: "npm-tag"
|
|
10
|
-
default: 'null'
|
|
11
|
-
required: false
|
|
12
|
-
- text: "BUILD_DOCUMENTATION_VERSION"
|
|
13
|
-
key: "build-documentation-version"
|
|
14
|
-
default: 'null'
|
|
15
|
-
hint: 'Leave NULL if no version is specified'
|
|
16
|
-
- text: "REMOVE_DOCUMENTATION_VERSION"
|
|
17
|
-
key: "remove-documentation-version"
|
|
18
|
-
default: 'null'
|
|
19
|
-
hint: 'Leave NULL if no version is specified'
|
|
20
|
-
|
|
21
|
-
- label: ":android: Android"
|
|
22
|
-
command:
|
|
23
|
-
- "nvm install"
|
|
24
|
-
- "npm install"
|
|
25
|
-
- "npm run test-js"
|
|
26
|
-
- "npm run test-unit-android -- --release"
|
|
27
|
-
- "npm run test-e2e-android-multi -- --release --headless --verbose --ci"
|
|
28
|
-
key: "android_build"
|
|
29
|
-
timeout_in_minutes: 90
|
|
30
|
-
|
|
31
|
-
- label: ":ios: iOS - Unit"
|
|
32
|
-
command:
|
|
33
|
-
- "nvm install"
|
|
34
|
-
- "npm install"
|
|
35
|
-
- "npm run test-unit-ios -- --release"
|
|
36
|
-
key: "ios_unit"
|
|
37
|
-
timeout_in_minutes: 90
|
|
38
|
-
|
|
39
|
-
- label: ":ios: iOS - E2E"
|
|
40
|
-
command:
|
|
41
|
-
- "nvm install"
|
|
42
|
-
- "npm install"
|
|
43
|
-
- "npm run test-snapshot-ios -- --release"
|
|
44
|
-
- "npm run test-e2e-ios -- --release --multi --ci"
|
|
45
|
-
key: "ios_e2e"
|
|
46
|
-
timeout_in_minutes: 90
|
|
47
|
-
|
|
48
|
-
- label: ":package: Publish"
|
|
49
|
-
env:
|
|
50
|
-
if: "build.pull_request.id == null"
|
|
51
|
-
command:
|
|
52
|
-
- "nvm install"
|
|
53
|
-
- "npm install"
|
|
54
|
-
- "npm run release"
|
|
55
|
-
depends_on:
|
|
56
|
-
- "android_build"
|
|
57
|
-
- "ios_unit"
|
|
58
|
-
- "ios_e2e"
|
|
59
|
-
timeout_in_minutes: 90
|
|
@@ -1,178 +0,0 @@
|
|
|
1
|
-
package com.reactnativenavigation;
|
|
2
|
-
|
|
3
|
-
import static com.reactnativenavigation.utils.CollectionUtils.forEach;
|
|
4
|
-
import static org.assertj.core.api.Java6Assertions.assertThat;
|
|
5
|
-
import static org.mockito.ArgumentMatchers.any;
|
|
6
|
-
import static org.mockito.Mockito.mock;
|
|
7
|
-
import static org.mockito.Mockito.when;
|
|
8
|
-
|
|
9
|
-
import android.app.Activity;
|
|
10
|
-
import android.content.Context;
|
|
11
|
-
import android.content.res.Configuration;
|
|
12
|
-
import android.content.res.Resources;
|
|
13
|
-
import android.os.Handler;
|
|
14
|
-
import android.os.Looper;
|
|
15
|
-
import android.view.View;
|
|
16
|
-
import android.view.ViewGroup;
|
|
17
|
-
|
|
18
|
-
import androidx.annotation.CallSuper;
|
|
19
|
-
import androidx.appcompat.app.AppCompatActivity;
|
|
20
|
-
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
21
|
-
|
|
22
|
-
import com.reactnativenavigation.options.params.Bool;
|
|
23
|
-
import com.reactnativenavigation.utils.Functions;
|
|
24
|
-
import com.reactnativenavigation.utils.SystemUiUtils;
|
|
25
|
-
import com.reactnativenavigation.utils.ViewUtils;
|
|
26
|
-
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;
|
|
27
|
-
|
|
28
|
-
import org.junit.After;
|
|
29
|
-
import org.junit.Before;
|
|
30
|
-
import org.junit.runner.RunWith;
|
|
31
|
-
import org.mockito.ArgumentMatchers;
|
|
32
|
-
import org.mockito.MockedStatic;
|
|
33
|
-
import org.mockito.Mockito;
|
|
34
|
-
import org.robolectric.Robolectric;
|
|
35
|
-
import org.robolectric.RobolectricTestRunner;
|
|
36
|
-
import org.robolectric.Shadows;
|
|
37
|
-
import org.robolectric.android.controller.ActivityController;
|
|
38
|
-
import org.robolectric.annotation.Config;
|
|
39
|
-
import org.robolectric.shadows.ShadowLooper;
|
|
40
|
-
|
|
41
|
-
import java.util.Arrays;
|
|
42
|
-
|
|
43
|
-
@RunWith(RobolectricTestRunner.class)
|
|
44
|
-
@Config(sdk = 28, application = TestApplication.class)
|
|
45
|
-
public abstract class BaseTest {
|
|
46
|
-
private final Handler handler = new Handler(Looper.getMainLooper());
|
|
47
|
-
private final ShadowLooper shadowMainLooper = Shadows.shadowOf(Looper.getMainLooper());
|
|
48
|
-
protected Configuration mockConfiguration;
|
|
49
|
-
|
|
50
|
-
@Before
|
|
51
|
-
public void beforeEach() {
|
|
52
|
-
NavigationApplication.instance = Mockito.mock(NavigationApplication.class);
|
|
53
|
-
mockConfiguration = Mockito.mock(Configuration.class);
|
|
54
|
-
Resources res = mock(Resources.class);
|
|
55
|
-
mockConfiguration.uiMode = Configuration.UI_MODE_NIGHT_NO;
|
|
56
|
-
when(res.getConfiguration()).thenReturn(mockConfiguration);
|
|
57
|
-
when(NavigationApplication.instance.getResources()).thenReturn(res);
|
|
58
|
-
when(res.getColor(ArgumentMatchers.anyInt())).thenReturn(0x00000);
|
|
59
|
-
when(res.getColor(ArgumentMatchers.anyInt(),any())).thenReturn(0x00000);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
public void mockSystemUiUtils(int statusBarHeight, int statusBarHeightDp, Functions.Func1<MockedStatic<SystemUiUtils>> mockedBlock) {
|
|
64
|
-
try (MockedStatic<SystemUiUtils> theMock = Mockito.mockStatic(SystemUiUtils.class)) {
|
|
65
|
-
theMock.when(() -> {
|
|
66
|
-
SystemUiUtils.getStatusBarHeight(any());
|
|
67
|
-
}).thenReturn(statusBarHeight);
|
|
68
|
-
theMock.when(() -> {
|
|
69
|
-
SystemUiUtils.getStatusBarHeightDp(any());
|
|
70
|
-
}).thenReturn(statusBarHeightDp);
|
|
71
|
-
mockedBlock.run(theMock);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
@After
|
|
76
|
-
@CallSuper
|
|
77
|
-
public void afterEach() {
|
|
78
|
-
idleMainLooper();
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
public Activity newActivity() {
|
|
82
|
-
return Robolectric.setupActivity(AppCompatActivity.class);
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
public <T extends AppCompatActivity> ActivityController<T> newActivityController(Class<T> clazz) {
|
|
86
|
-
return Robolectric.buildActivity(clazz);
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
public void assertIsChild(ViewGroup parent, ViewController<?>... children) {
|
|
90
|
-
forEach(Arrays.asList(children), c -> assertIsChild(parent, c.getView()));
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
public void assertIsChild(ViewGroup parent, View child) {
|
|
94
|
-
assertThat(parent).isNotNull();
|
|
95
|
-
assertThat(child).isNotNull();
|
|
96
|
-
assertThat(ViewUtils.isChildOf(parent, child)).isTrue();
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
public void assertNotChildOf(ViewGroup parent, ViewController<?>... children) {
|
|
100
|
-
forEach(Arrays.asList(children), c -> assertNotChildOf(parent, c.getView()));
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
public void assertNotChildOf(ViewGroup parent, View child) {
|
|
104
|
-
assertThat(parent).isNotNull();
|
|
105
|
-
assertThat(child).isNotNull();
|
|
106
|
-
assertThat(ViewUtils.isChildOf(parent, child)).isFalse();
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
public void assertMatchParent(View view) {
|
|
110
|
-
assertThat(view.getLayoutParams().width).isEqualTo(ViewGroup.LayoutParams.MATCH_PARENT);
|
|
111
|
-
assertThat(view.getLayoutParams().height).isEqualTo(ViewGroup.LayoutParams.MATCH_PARENT);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
protected void disablePushAnimation(ViewController<?>... controllers) {
|
|
115
|
-
for (ViewController<?> controller : controllers) {
|
|
116
|
-
controller.options.animations.push.enabled = new Bool(false);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
protected void disablePopAnimation(ViewController<?>... controllers) {
|
|
121
|
-
for (ViewController<?> controller : controllers) {
|
|
122
|
-
controller.options.animations.pop.enabled = new Bool(false);
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
protected void disableModalAnimations(ViewController<?>... modals) {
|
|
127
|
-
disableShowModalAnimation(modals);
|
|
128
|
-
disableDismissModalAnimation(modals);
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
protected void disableShowModalAnimation(ViewController<?>... modals) {
|
|
132
|
-
for (ViewController<?> modal : modals) {
|
|
133
|
-
modal.options.animations.showModal.toggle(new Bool(false));
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
protected void disableDismissModalAnimation(ViewController<?>... modals) {
|
|
138
|
-
for (ViewController<?> modal : modals) {
|
|
139
|
-
modal.options.animations.dismissModal.toggle(new Bool(false));
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
protected void dispatchPreDraw(View view) {
|
|
144
|
-
view.getViewTreeObserver().dispatchOnPreDraw();
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
protected void dispatchOnGlobalLayout(View view) {
|
|
148
|
-
view.getViewTreeObserver().dispatchOnGlobalLayout();
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
protected void addToParent(Context context, ViewController<?>... controllers) {
|
|
152
|
-
for (ViewController<?> controller : controllers) {
|
|
153
|
-
new CoordinatorLayout(context).addView(controller.getView());
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
protected View mockView(Activity activity) {
|
|
158
|
-
View mock = Mockito.mock(View.class);
|
|
159
|
-
when(mock.getContext()).thenReturn(activity);
|
|
160
|
-
return mock;
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
protected void assertVisible(View view) {
|
|
164
|
-
assertThat(view.getVisibility()).isEqualTo(View.VISIBLE);
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
protected void assertGone(View view) {
|
|
168
|
-
assertThat(view.getVisibility()).isEqualTo(View.GONE);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
protected void post(Runnable runnable) {
|
|
172
|
-
handler.post(runnable);
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
protected void idleMainLooper() {
|
|
176
|
-
shadowMainLooper.idle();
|
|
177
|
-
}
|
|
178
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
package com.reactnativenavigation;
|
|
2
|
-
|
|
3
|
-
import com.google.android.material.floatingactionbutton.FloatingActionButton;
|
|
4
|
-
import androidx.appcompat.app.AppCompatActivity;
|
|
5
|
-
|
|
6
|
-
import com.facebook.react.common.*;
|
|
7
|
-
|
|
8
|
-
import org.junit.*;
|
|
9
|
-
import org.robolectric.*;
|
|
10
|
-
|
|
11
|
-
import static org.assertj.core.api.Java6Assertions.*;
|
|
12
|
-
|
|
13
|
-
public class EnvironmentTest extends BaseTest {
|
|
14
|
-
@Test
|
|
15
|
-
public void assertJ() {
|
|
16
|
-
assertThat(1 + 2).isEqualTo(3).isGreaterThan(2).isLessThan(4).isNotNegative().isPositive().isNotZero();
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@Test
|
|
20
|
-
public void react() {
|
|
21
|
-
assertThat(ReactConstants.TAG).isNotEmpty();
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
@Test
|
|
25
|
-
public void supportV7AppCompat() {
|
|
26
|
-
assertThat(AppCompatActivity.class).isNotNull();
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
@Test
|
|
30
|
-
public void supportDesign() {
|
|
31
|
-
assertThat(FloatingActionButton.class).isNotNull();
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@Test
|
|
35
|
-
public void androidR() {
|
|
36
|
-
assertThat(R.string.bottom_sheet_behavior).isNotZero();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
@Test
|
|
40
|
-
public void ableToLoadApplication() throws Exception {
|
|
41
|
-
assertThat(RuntimeEnvironment.application).isNotNull();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
package com.reactnativenavigation;
|
|
2
|
-
|
|
3
|
-
import com.reactnativenavigation.react.ReactGateway;
|
|
4
|
-
import com.reactnativenavigation.viewcontrollers.navigator.Navigator;
|
|
5
|
-
|
|
6
|
-
import org.mockito.Mockito;
|
|
7
|
-
|
|
8
|
-
public class TestActivity extends NavigationActivity {
|
|
9
|
-
|
|
10
|
-
@Override
|
|
11
|
-
public ReactGateway getReactGateway() {
|
|
12
|
-
return Mockito.mock(ReactGateway.class);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
public void setNavigator(Navigator navigator) {
|
|
16
|
-
this.navigator = navigator;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@Override
|
|
20
|
-
public void onBackPressed() {
|
|
21
|
-
super.onBackPressed();
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
package com.reactnativenavigation;
|
|
2
|
-
|
|
3
|
-
import android.app.*;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.ReactApplication;
|
|
6
|
-
import com.facebook.react.ReactNativeHost;
|
|
7
|
-
import com.facebook.react.ReactPackage;
|
|
8
|
-
|
|
9
|
-
import java.util.Collections;
|
|
10
|
-
import java.util.List;
|
|
11
|
-
|
|
12
|
-
public class TestApplication extends Application implements ReactApplication {
|
|
13
|
-
private final ReactNativeHost host = new ReactNativeHost(this) {
|
|
14
|
-
@Override
|
|
15
|
-
public boolean getUseDeveloperSupport() {
|
|
16
|
-
return true;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
@Override
|
|
20
|
-
protected List<ReactPackage> getPackages() {
|
|
21
|
-
return Collections.emptyList();
|
|
22
|
-
}
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
@Override
|
|
26
|
-
public void onCreate() {
|
|
27
|
-
super.onCreate();
|
|
28
|
-
setTheme(R.style.Theme_AppCompat);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@Override
|
|
32
|
-
public ReactNativeHost getReactNativeHost() {
|
|
33
|
-
return host;
|
|
34
|
-
}
|
|
35
|
-
}
|