react-native-navigation 7.25.4 → 7.26.0-alpha.1-snapshot.595
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/NavigationButton.tsx +1 -0
- package/lib/Mock/mocks/NativeCommandsSender.tsx +16 -11
- package/lib/android/app/build.gradle +7 -11
- package/lib/android/app/src/main/java/com/reactnativenavigation/NavigationActivity.java +9 -7
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/BottomTabOptions.java +0 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/Orientation.java +2 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/OrientationOptions.java +2 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/OverlayOptions.java +2 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/parsers/JSONParser.java +2 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/NavigationModule.java +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabPresenter.java +1 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java +4 -31
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/child/ChildController.java +13 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewController.java +46 -61
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/modal/ModalStack.java +0 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/navigator/Navigator.java +6 -20
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/overlay/OverlayManager.kt +33 -104
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/parent/ParentController.java +9 -86
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuController.java +0 -12
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +2 -19
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +244 -212
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarController.kt +22 -185
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonController.kt +5 -32
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/button/ButtonPresenter.kt +1 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/RootPresenter.java +1 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/ViewController.java +0 -12
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabs.java +1 -29
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabsContainer.kt +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/bottomtabs/BottomTabsLayout.java +1 -10
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/component/ComponentLayout.java +2 -10
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/sidemenu/SideMenuRoot.java +1 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/StackLayout.java +4 -14
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/TopBar.java +1 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/ButtonBar.kt +12 -7
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleAndButtonsContainer.kt +2 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/stack/topbar/titlebar/TitleSubTitleLayout.kt +7 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/toptabs/TopTabsStyleHelper.java +1 -0
- package/lib/android/app/src/{main → reactNative51}/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +0 -0
- package/lib/android/app/src/reactNative55/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +81 -0
- package/lib/android/app/src/reactNative56/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +81 -0
- package/lib/android/app/src/reactNative57/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +81 -0
- package/lib/android/app/src/reactNative57_5/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +81 -0
- package/lib/android/app/src/reactNative60/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +81 -0
- package/lib/android/app/src/reactNative62/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +81 -0
- package/lib/android/app/src/reactNative63/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +81 -0
- package/lib/android/app/src/reactNative68/java/com/reactnativenavigation/options/parsers/ColorParser.kt +38 -0
- package/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/DevBundleDownloadListenerAdapter.java +22 -0
- package/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/JsDevReloadHandlerFacade.java +22 -0
- package/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/NavigationReactNativeHost.java +66 -0
- package/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/ReactGateway.java +72 -0
- package/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/ReloadHandlerFacade.java +22 -0
- package/lib/android/app/src/reactNative68/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +87 -0
- package/lib/android/app/src/reactNative68/java/com/reactnativenavigation/viewcontrollers/viewcontroller/YellowBoxHelper.java +12 -0
- package/lib/dist/Mock/Components/NavigationButton.js +1 -1
- package/lib/dist/Mock/mocks/NativeCommandsSender.js +17 -11
- package/lib/dist/src/interfaces/Options.d.ts +1 -25
- package/lib/ios/RNNComponentRootView.m +14 -0
- package/lib/src/interfaces/Options.ts +6 -27
- package/package.json +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/OverlayOptions.kt +0 -31
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/overlay/AttachedOverlayContainer.kt +0 -69
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/overlay/ViewTooltip.java +0 -921
|
@@ -18,6 +18,7 @@ export const NavigationButton = class extends Component<ButtonProps> {
|
|
|
18
18
|
testID={button.testID}
|
|
19
19
|
key={button.id}
|
|
20
20
|
title={button.text || ''}
|
|
21
|
+
disabled={button.enabled === false}
|
|
21
22
|
onPress={() =>
|
|
22
23
|
button.enabled !== false &&
|
|
23
24
|
events.invokeNavigationButtonPressed({
|
|
@@ -77,17 +77,22 @@ export class NativeCommandsSender {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
dismissModal(_commandId: string, componentId: string, _options?: object) {
|
|
80
|
-
return new Promise((resolve) => {
|
|
81
|
-
const modal = LayoutStore.getModalById(componentId)
|
|
82
|
-
modal
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
80
|
+
return new Promise((resolve, reject) => {
|
|
81
|
+
const modal = LayoutStore.getModalById(componentId);
|
|
82
|
+
if (modal) {
|
|
83
|
+
const modalTopParent = modal.getTopParent();
|
|
84
|
+
modalTopParent.componentDidDisappear();
|
|
85
|
+
LayoutStore.dismissModal(componentId);
|
|
86
|
+
events.invokeModalDismissed({
|
|
87
|
+
componentName: modalTopParent.data.name,
|
|
88
|
+
componentId: modalTopParent.nodeId,
|
|
89
|
+
modalsDismissed: 1,
|
|
90
|
+
});
|
|
91
|
+
resolve(modalTopParent.nodeId);
|
|
92
|
+
LayoutStore.getVisibleLayout().componentDidAppear();
|
|
93
|
+
} else {
|
|
94
|
+
reject(`component with id: ${componentId} is not a modal`);
|
|
95
|
+
}
|
|
91
96
|
});
|
|
92
97
|
}
|
|
93
98
|
|
|
@@ -106,6 +106,10 @@ android {
|
|
|
106
106
|
dimension "RNN.reactNativeVersion"
|
|
107
107
|
buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "63")
|
|
108
108
|
}
|
|
109
|
+
reactNative68 {
|
|
110
|
+
dimension "RNN.reactNativeVersion"
|
|
111
|
+
buildConfigField("int", "REACT_NATVE_VERSION_MINOR", "68")
|
|
112
|
+
}
|
|
109
113
|
}
|
|
110
114
|
|
|
111
115
|
def flavor = resolveFlavor()
|
|
@@ -122,7 +126,9 @@ String resolveFlavor() {
|
|
|
122
126
|
Integer reactNativeMinorComponent = reactNativeVersionComponents[1].toInteger()
|
|
123
127
|
Integer reactNativePatchComponent = reactNativeVersionComponents[2].toInteger()
|
|
124
128
|
|
|
125
|
-
if (reactNativeMinorComponent >=
|
|
129
|
+
if (reactNativeMinorComponent >= 68) {
|
|
130
|
+
return "reactNative68"
|
|
131
|
+
} else if (reactNativeMinorComponent >= 63) {
|
|
126
132
|
return "reactNative63"
|
|
127
133
|
} else if (reactNativeMinorComponent >= 62) {
|
|
128
134
|
return "reactNative62"
|
|
@@ -161,16 +167,6 @@ List reactNativeVersionComponents(rnPackageJsonFile) {
|
|
|
161
167
|
return reactNativeVersion.tokenize('-')[0].tokenize('.')
|
|
162
168
|
}
|
|
163
169
|
|
|
164
|
-
allprojects { p ->
|
|
165
|
-
p.afterEvaluate {
|
|
166
|
-
p.android.compileOptions.sourceCompatibility JavaVersion.VERSION_1_8
|
|
167
|
-
p.android.compileOptions.targetCompatibility JavaVersion.VERSION_1_8
|
|
168
|
-
}
|
|
169
|
-
p.repositories {
|
|
170
|
-
maven { url "https://jitpack.io" }
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
|
|
174
170
|
dependencies {
|
|
175
171
|
|
|
176
172
|
implementation "androidx.core:core-ktx:1.6.0"
|
|
@@ -3,26 +3,28 @@ package com.reactnativenavigation;
|
|
|
3
3
|
import android.annotation.TargetApi;
|
|
4
4
|
import android.content.Intent;
|
|
5
5
|
import android.content.res.Configuration;
|
|
6
|
+
import android.graphics.Color;
|
|
6
7
|
import android.os.Build;
|
|
7
8
|
import android.os.Bundle;
|
|
8
9
|
import android.view.KeyEvent;
|
|
9
10
|
import android.view.View;
|
|
10
11
|
|
|
11
|
-
import androidx.annotation.NonNull;
|
|
12
|
-
import androidx.annotation.Nullable;
|
|
13
|
-
import androidx.appcompat.app.AppCompatActivity;
|
|
14
|
-
|
|
15
12
|
import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler;
|
|
16
13
|
import com.facebook.react.modules.core.PermissionAwareActivity;
|
|
17
14
|
import com.facebook.react.modules.core.PermissionListener;
|
|
18
|
-
import com.reactnativenavigation.
|
|
15
|
+
import com.reactnativenavigation.options.Options;
|
|
16
|
+
import com.reactnativenavigation.viewcontrollers.overlay.OverlayManager;
|
|
17
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.RootPresenter;
|
|
19
18
|
import com.reactnativenavigation.react.JsDevReloadHandler;
|
|
20
19
|
import com.reactnativenavigation.react.ReactGateway;
|
|
20
|
+
import com.reactnativenavigation.react.CommandListenerAdapter;
|
|
21
21
|
import com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry;
|
|
22
22
|
import com.reactnativenavigation.viewcontrollers.modal.ModalStack;
|
|
23
23
|
import com.reactnativenavigation.viewcontrollers.navigator.Navigator;
|
|
24
|
-
|
|
25
|
-
import
|
|
24
|
+
|
|
25
|
+
import androidx.annotation.NonNull;
|
|
26
|
+
import androidx.annotation.Nullable;
|
|
27
|
+
import androidx.appcompat.app.AppCompatActivity;
|
|
26
28
|
|
|
27
29
|
public class NavigationActivity extends AppCompatActivity implements DefaultHardwareBackBtnHandler, PermissionAwareActivity, JsDevReloadHandler.ReloadListener {
|
|
28
30
|
@Nullable
|
package/lib/android/app/src/main/java/com/reactnativenavigation/options/BottomTabOptions.java
CHANGED
|
@@ -25,7 +25,6 @@ public class BottomTabOptions {
|
|
|
25
25
|
BottomTabOptions options = new BottomTabOptions();
|
|
26
26
|
if (json == null) return options;
|
|
27
27
|
|
|
28
|
-
options.id = TextParser.parse(json, "id");
|
|
29
28
|
options.text = TextParser.parse(json, "text");
|
|
30
29
|
options.textColor = ThemeColour.parse(context, json.optJSONObject("textColor"));
|
|
31
30
|
options.selectedTextColor = ThemeColour.parse(context, json.optJSONObject("selectedTextColor"));
|
|
@@ -49,7 +48,6 @@ public class BottomTabOptions {
|
|
|
49
48
|
return options;
|
|
50
49
|
}
|
|
51
50
|
|
|
52
|
-
public Text id = new NullText();
|
|
53
51
|
public Text text = new NullText();
|
|
54
52
|
public ThemeColour textColor = new NullThemeColour();
|
|
55
53
|
public ThemeColour selectedTextColor = new NullThemeColour();
|
|
@@ -72,7 +70,6 @@ public class BottomTabOptions {
|
|
|
72
70
|
|
|
73
71
|
|
|
74
72
|
void mergeWith(final BottomTabOptions other) {
|
|
75
|
-
if (other.id.hasValue()) id = other.id;
|
|
76
73
|
if (other.textColor.hasValue()) textColor = other.textColor;
|
|
77
74
|
if (other.selectedTextColor.hasValue()) selectedTextColor = other.selectedTextColor;
|
|
78
75
|
if (other.iconColor.hasValue()) iconColor = other.iconColor;
|
|
@@ -96,7 +93,6 @@ public class BottomTabOptions {
|
|
|
96
93
|
}
|
|
97
94
|
|
|
98
95
|
void mergeWithDefault(final BottomTabOptions defaultOptions) {
|
|
99
|
-
if (!id.hasValue()) id = defaultOptions.id;
|
|
100
96
|
if (!textColor.hasValue()) textColor = defaultOptions.textColor;
|
|
101
97
|
if (!selectedTextColor.hasValue()) selectedTextColor = defaultOptions.selectedTextColor;
|
|
102
98
|
if (!iconColor.hasValue()) iconColor = defaultOptions.iconColor;
|
|
@@ -8,7 +8,8 @@ public enum Orientation {
|
|
|
8
8
|
Landscape("landscape", ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE),
|
|
9
9
|
Portrait("portrait", ActivityInfo.SCREEN_ORIENTATION_PORTRAIT),
|
|
10
10
|
PortraitLandscape("sensor", ActivityInfo.SCREEN_ORIENTATION_USER),
|
|
11
|
-
SensorLandscape("sensorLandscape", ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE)
|
|
11
|
+
SensorLandscape("sensorLandscape", ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE),
|
|
12
|
+
SensorPortrait("sensorPortrait", ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
|
|
12
13
|
|
|
13
14
|
public String name;
|
|
14
15
|
public int orientationCode;
|
package/lib/android/app/src/main/java/com/reactnativenavigation/options/OrientationOptions.java
CHANGED
|
@@ -44,6 +44,8 @@ public class OrientationOptions {
|
|
|
44
44
|
return orientations.contains(Orientation.Landscape) ? Orientation.PortraitLandscape.orientationCode : Orientation.Portrait.orientationCode;
|
|
45
45
|
case SensorLandscape:
|
|
46
46
|
return Orientation.SensorLandscape.orientationCode;
|
|
47
|
+
case SensorPortrait:
|
|
48
|
+
return Orientation.SensorPortrait.orientationCode;
|
|
47
49
|
default:
|
|
48
50
|
case Default:
|
|
49
51
|
return Orientation.Default.orientationCode;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
package com.reactnativenavigation.options;
|
|
3
2
|
|
|
4
3
|
import com.reactnativenavigation.options.params.Bool;
|
|
@@ -9,11 +8,11 @@ import org.json.JSONObject;
|
|
|
9
8
|
|
|
10
9
|
public class OverlayOptions {
|
|
11
10
|
public Bool interceptTouchOutside = new NullBool();
|
|
12
|
-
|
|
11
|
+
|
|
13
12
|
public static OverlayOptions parse(JSONObject json) {
|
|
14
13
|
OverlayOptions options = new OverlayOptions();
|
|
15
14
|
if (json == null) return options;
|
|
16
|
-
|
|
15
|
+
|
|
17
16
|
options.interceptTouchOutside = BoolParser.parse(json,"interceptTouchOutside");
|
|
18
17
|
return options;
|
|
19
18
|
}
|
package/lib/android/app/src/main/java/com/reactnativenavigation/options/parsers/JSONParser.java
CHANGED
|
@@ -6,6 +6,8 @@ import com.facebook.react.bridge.ReadableMap;
|
|
|
6
6
|
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
|
7
7
|
import com.facebook.react.bridge.WritableArray;
|
|
8
8
|
import com.facebook.react.bridge.WritableMap;
|
|
9
|
+
import com.facebook.react.bridge.WritableNativeArray;
|
|
10
|
+
import com.facebook.react.bridge.WritableNativeMap;
|
|
9
11
|
|
|
10
12
|
import org.json.JSONArray;
|
|
11
13
|
import org.json.JSONException;
|
|
@@ -59,7 +59,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
|
|
59
59
|
@Override
|
|
60
60
|
public void onHostPause() {
|
|
61
61
|
super.onHostPause();
|
|
62
|
-
navigator().onHostPause();
|
|
62
|
+
UiUtils.runOnMainThread(() -> navigator().onHostPause());
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
@Override
|
|
@@ -72,7 +72,7 @@ public class NavigationModule extends ReactContextBaseJavaModule {
|
|
|
72
72
|
navigator().getChildRegistry(),
|
|
73
73
|
((NavigationApplication) activity().getApplication()).getExternalComponents()
|
|
74
74
|
);
|
|
75
|
-
navigator().onHostResume();
|
|
75
|
+
UiUtils.runOnMainThread(() -> navigator().onHostResume());
|
|
76
76
|
}
|
|
77
77
|
});
|
|
78
78
|
}
|
|
@@ -9,6 +9,7 @@ import android.graphics.drawable.Drawable;
|
|
|
9
9
|
|
|
10
10
|
import androidx.annotation.NonNull;
|
|
11
11
|
|
|
12
|
+
import com.aurelhubert.ahbottomnavigation.AHTextView;
|
|
12
13
|
import com.aurelhubert.ahbottomnavigation.notification.AHNotification;
|
|
13
14
|
import com.reactnativenavigation.options.BottomTabOptions;
|
|
14
15
|
import com.reactnativenavigation.options.DotIndicatorOptions;
|
|
@@ -57,7 +58,6 @@ public class BottomTabPresenter {
|
|
|
57
58
|
bottomTabs.perform(bottomTabs -> {
|
|
58
59
|
for (int i = 0; i < tabs.size(); i++) {
|
|
59
60
|
BottomTabOptions tab = tabs.get(i).resolveCurrentOptions(defaultOptions).bottomTabOptions;
|
|
60
|
-
bottomTabs.setTagForTabIndex(i, tab.id.get(null));
|
|
61
61
|
bottomTabs.setIconWidth(i, tab.iconWidth.get(null));
|
|
62
62
|
bottomTabs.setIconHeight(i, tab.iconHeight.get(null));
|
|
63
63
|
bottomTabs.setTitleTypeface(i, tab.font.getTypeface(typefaceLoader, defaultTypeface));
|
|
@@ -87,7 +87,6 @@ public class BottomTabPresenter {
|
|
|
87
87
|
int index = bottomTabFinder.findByControllerId(child.getId());
|
|
88
88
|
if (index >= 0) {
|
|
89
89
|
BottomTabOptions tab = options.bottomTabOptions;
|
|
90
|
-
if (tab.id.hasValue()) bottomTabs.setTagForTabIndex(index, tab.id.get());
|
|
91
90
|
if (tab.iconWidth.hasValue()) bottomTabs.setIconWidth(index, tab.iconWidth.get(null));
|
|
92
91
|
if (tab.iconHeight.hasValue()) bottomTabs.setIconHeight(index, tab.iconHeight.get(null));
|
|
93
92
|
if (tab.font.hasValue()) bottomTabs.setTitleTypeface(index, tab.font.getTypeface(typefaceLoader, defaultTypeface));
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
package com.reactnativenavigation.viewcontrollers.bottomtabs;
|
|
2
2
|
|
|
3
|
-
import static com.reactnativenavigation.utils.CollectionUtils.forEach;
|
|
4
|
-
import static com.reactnativenavigation.utils.CollectionUtils.map;
|
|
5
|
-
import static com.reactnativenavigation.utils.ObjectUtils.perform;
|
|
6
|
-
import static com.reactnativenavigation.views.bottomtabs.BottomTabs.TAB_NOT_FOUND;
|
|
7
|
-
|
|
8
3
|
import android.animation.Animator;
|
|
9
4
|
import android.app.Activity;
|
|
10
5
|
import android.content.res.Configuration;
|
|
@@ -12,7 +7,6 @@ import android.view.View;
|
|
|
12
7
|
import android.view.ViewGroup;
|
|
13
8
|
|
|
14
9
|
import androidx.annotation.NonNull;
|
|
15
|
-
import androidx.annotation.Nullable;
|
|
16
10
|
import androidx.annotation.RestrictTo;
|
|
17
11
|
import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
18
12
|
|
|
@@ -21,7 +15,6 @@ import com.aurelhubert.ahbottomnavigation.AHBottomNavigationItem;
|
|
|
21
15
|
import com.reactnativenavigation.options.BottomTabOptions;
|
|
22
16
|
import com.reactnativenavigation.options.HwBackBottomTabsBehaviour;
|
|
23
17
|
import com.reactnativenavigation.options.Options;
|
|
24
|
-
import com.reactnativenavigation.options.OverlayAttachOptions;
|
|
25
18
|
import com.reactnativenavigation.react.CommandListener;
|
|
26
19
|
import com.reactnativenavigation.react.CommandListenerAdapter;
|
|
27
20
|
import com.reactnativenavigation.react.events.EventEmitter;
|
|
@@ -32,7 +25,6 @@ import com.reactnativenavigation.viewcontrollers.parent.ParentController;
|
|
|
32
25
|
import com.reactnativenavigation.viewcontrollers.stack.StackController;
|
|
33
26
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter;
|
|
34
27
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;
|
|
35
|
-
import com.reactnativenavigation.views.overlay.ViewTooltip;
|
|
36
28
|
import com.reactnativenavigation.views.bottomtabs.BottomTabs;
|
|
37
29
|
import com.reactnativenavigation.views.bottomtabs.BottomTabsContainer;
|
|
38
30
|
import com.reactnativenavigation.views.bottomtabs.BottomTabsLayout;
|
|
@@ -42,6 +34,10 @@ import java.util.Deque;
|
|
|
42
34
|
import java.util.LinkedList;
|
|
43
35
|
import java.util.List;
|
|
44
36
|
|
|
37
|
+
import static com.reactnativenavigation.utils.CollectionUtils.forEach;
|
|
38
|
+
import static com.reactnativenavigation.utils.CollectionUtils.map;
|
|
39
|
+
import static com.reactnativenavigation.utils.ObjectUtils.perform;
|
|
40
|
+
|
|
45
41
|
public class BottomTabsController extends ParentController<BottomTabsLayout> implements AHBottomNavigation.OnTabSelectedListener, TabSelector {
|
|
46
42
|
|
|
47
43
|
private BottomTabsContainer bottomTabsContainer;
|
|
@@ -242,29 +238,6 @@ public class BottomTabsController extends ParentController<BottomTabsLayout> imp
|
|
|
242
238
|
return super.onMeasureChild(parent, child, parentWidthMeasureSpec, widthUsed, parentHeightMeasureSpec, heightUsed);
|
|
243
239
|
}
|
|
244
240
|
|
|
245
|
-
@Override
|
|
246
|
-
public ViewTooltip.TooltipView showAnchoredOverlay(@NonNull View anchorView, @NonNull OverlayAttachOptions overlayAttachOptions,
|
|
247
|
-
@NonNull ViewController<?> overlayViewController) {
|
|
248
|
-
if(view!=null){
|
|
249
|
-
return view.getAttachedOverlayContainer().addAnchoredView(anchorView, overlayViewController.getView(),
|
|
250
|
-
overlayAttachOptions.gravity.get());
|
|
251
|
-
}
|
|
252
|
-
return null;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
public View getTabViewByTag(String id) {
|
|
256
|
-
int tabIndex = bottomTabs.getTabIndexByTag(id);
|
|
257
|
-
if (tabIndex != TAB_NOT_FOUND) {
|
|
258
|
-
return bottomTabs.getViewAtPosition(tabIndex);
|
|
259
|
-
}
|
|
260
|
-
return null;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
@Override
|
|
264
|
-
public List<ViewController<?>> getChildren() {
|
|
265
|
-
return tabs;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
241
|
@Override
|
|
269
242
|
public int getBottomInset(ViewController<?> child) {
|
|
270
243
|
return presenter.getBottomInset(resolveChildOptions(child)) + perform(getParentController(), 0, p -> p.getBottomInset(this));
|
|
@@ -2,21 +2,28 @@ package com.reactnativenavigation.viewcontrollers.child;
|
|
|
2
2
|
|
|
3
3
|
import android.app.Activity;
|
|
4
4
|
import android.content.res.Configuration;
|
|
5
|
+
import android.os.Build;
|
|
6
|
+
import android.util.Log;
|
|
5
7
|
import android.view.View;
|
|
6
8
|
import android.view.ViewGroup;
|
|
7
|
-
|
|
8
|
-
import androidx.annotation.CallSuper;
|
|
9
|
-
import androidx.core.view.ViewCompat;
|
|
10
|
-
import androidx.core.view.WindowInsetsCompat;
|
|
9
|
+
import android.view.WindowInsets;
|
|
11
10
|
|
|
12
11
|
import com.reactnativenavigation.options.Options;
|
|
13
|
-
import com.reactnativenavigation.
|
|
14
|
-
import com.reactnativenavigation.viewcontrollers.
|
|
12
|
+
import com.reactnativenavigation.utils.LogKt;
|
|
13
|
+
import com.reactnativenavigation.viewcontrollers.parent.ParentController;
|
|
15
14
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter;
|
|
15
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.NoOpYellowBoxDelegate;
|
|
16
|
+
import com.reactnativenavigation.viewcontrollers.navigator.Navigator;
|
|
16
17
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;
|
|
17
18
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.overlay.ViewControllerOverlay;
|
|
18
19
|
import com.reactnativenavigation.views.component.Component;
|
|
19
20
|
|
|
21
|
+
import androidx.annotation.CallSuper;
|
|
22
|
+
import androidx.core.graphics.Insets;
|
|
23
|
+
import androidx.core.view.ViewCompat;
|
|
24
|
+
import androidx.core.view.WindowCompat;
|
|
25
|
+
import androidx.core.view.WindowInsetsCompat;
|
|
26
|
+
|
|
20
27
|
public abstract class ChildController<T extends ViewGroup> extends ViewController<T> {
|
|
21
28
|
private final Presenter presenter;
|
|
22
29
|
private final ChildControllersRegistry childRegistry;
|
|
@@ -3,10 +3,8 @@ package com.reactnativenavigation.viewcontrollers.component;
|
|
|
3
3
|
import android.app.Activity;
|
|
4
4
|
import android.content.res.Configuration;
|
|
5
5
|
import android.view.View;
|
|
6
|
-
import android.view.ViewGroup;
|
|
7
|
-
import android.view.WindowManager;
|
|
8
6
|
|
|
9
|
-
import com.reactnativenavigation.
|
|
7
|
+
import com.reactnativenavigation.utils.LogKt;
|
|
10
8
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.ScrollEventListener;
|
|
11
9
|
import com.reactnativenavigation.options.Options;
|
|
12
10
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter;
|
|
@@ -15,42 +13,34 @@ import com.reactnativenavigation.viewcontrollers.viewcontroller.ReactViewCreator
|
|
|
15
13
|
import com.reactnativenavigation.viewcontrollers.child.ChildController;
|
|
16
14
|
import com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry;
|
|
17
15
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;
|
|
18
|
-
import com.reactnativenavigation.views.overlay.ViewTooltip;
|
|
19
16
|
import com.reactnativenavigation.views.component.ComponentLayout;
|
|
20
17
|
|
|
21
18
|
import androidx.annotation.NonNull;
|
|
22
|
-
import androidx.annotation.Nullable;
|
|
23
19
|
import androidx.core.graphics.Insets;
|
|
24
20
|
import androidx.core.view.ViewCompat;
|
|
25
|
-
import androidx.core.view.ViewKt;
|
|
26
21
|
import androidx.core.view.WindowInsetsCompat;
|
|
27
22
|
|
|
28
23
|
import static com.reactnativenavigation.utils.ObjectUtils.perform;
|
|
29
24
|
|
|
30
|
-
import kotlin.Unit;
|
|
31
|
-
|
|
32
25
|
public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
33
26
|
private final String componentName;
|
|
34
27
|
private final ComponentPresenter presenter;
|
|
35
28
|
private final ReactViewCreator viewCreator;
|
|
36
|
-
private boolean ignoreInsets = false;
|
|
37
29
|
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
private enum VisibilityState {
|
|
31
|
+
Appear, Disappear
|
|
40
32
|
}
|
|
41
33
|
|
|
42
|
-
private enum VisibilityState {Appear, Disappear}
|
|
43
|
-
|
|
44
34
|
private VisibilityState lastVisibilityState = VisibilityState.Disappear;
|
|
45
35
|
|
|
46
36
|
public ComponentViewController(final Activity activity,
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
37
|
+
final ChildControllersRegistry childRegistry,
|
|
38
|
+
final String id,
|
|
39
|
+
final String componentName,
|
|
40
|
+
final ReactViewCreator viewCreator,
|
|
41
|
+
final Options initialOptions,
|
|
42
|
+
final Presenter presenter,
|
|
43
|
+
final ComponentPresenter componentPresenter) {
|
|
54
44
|
super(activity, childRegistry, id, presenter, initialOptions);
|
|
55
45
|
this.componentName = componentName;
|
|
56
46
|
this.viewCreator = viewCreator;
|
|
@@ -59,7 +49,8 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
59
49
|
|
|
60
50
|
@Override
|
|
61
51
|
public void start() {
|
|
62
|
-
if (!isDestroyed())
|
|
52
|
+
if (!isDestroyed())
|
|
53
|
+
getView().start();
|
|
63
54
|
}
|
|
64
55
|
|
|
65
56
|
@Override
|
|
@@ -90,19 +81,20 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
90
81
|
if (view != null)
|
|
91
82
|
view.sendComponentWillStart();
|
|
92
83
|
super.onViewDidAppear();
|
|
93
|
-
if (view != null)
|
|
84
|
+
if (view != null)
|
|
94
85
|
view.requestApplyInsets();
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
}
|
|
86
|
+
if (view != null && lastVisibilityState == VisibilityState.Disappear)
|
|
87
|
+
view.sendComponentStart();
|
|
98
88
|
lastVisibilityState = VisibilityState.Appear;
|
|
99
89
|
}
|
|
100
90
|
|
|
101
91
|
@Override
|
|
102
92
|
public void onViewDisappear() {
|
|
103
|
-
if (lastVisibilityState == VisibilityState.Disappear)
|
|
93
|
+
if (lastVisibilityState == VisibilityState.Disappear)
|
|
94
|
+
return;
|
|
104
95
|
lastVisibilityState = VisibilityState.Disappear;
|
|
105
|
-
if (view != null)
|
|
96
|
+
if (view != null)
|
|
97
|
+
view.sendComponentStop();
|
|
106
98
|
super.onViewDisappear();
|
|
107
99
|
}
|
|
108
100
|
|
|
@@ -113,7 +105,8 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
113
105
|
|
|
114
106
|
@Override
|
|
115
107
|
public void applyOptions(Options options) {
|
|
116
|
-
if (isRoot())
|
|
108
|
+
if (isRoot())
|
|
109
|
+
applyTopInset();
|
|
117
110
|
super.applyOptions(options);
|
|
118
111
|
getView().applyOptions(options);
|
|
119
112
|
presenter.applyOptions(getView(), resolveCurrentOptions(presenter.defaultOptions));
|
|
@@ -133,50 +126,51 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
133
126
|
|
|
134
127
|
@Override
|
|
135
128
|
public void mergeOptions(Options options) {
|
|
136
|
-
if (options == Options.EMPTY)
|
|
137
|
-
|
|
129
|
+
if (options == Options.EMPTY)
|
|
130
|
+
return;
|
|
131
|
+
if (isViewShown())
|
|
132
|
+
presenter.mergeOptions(getView(), options);
|
|
138
133
|
super.mergeOptions(options);
|
|
139
134
|
}
|
|
140
135
|
|
|
141
136
|
@Override
|
|
142
137
|
public void applyTopInset() {
|
|
143
|
-
if (view != null
|
|
138
|
+
if (view != null)
|
|
139
|
+
presenter.applyTopInsets(view, getTopInset());
|
|
144
140
|
}
|
|
145
141
|
|
|
146
142
|
@Override
|
|
147
143
|
public int getTopInset() {
|
|
148
|
-
int statusBarInset = resolveCurrentOptions(presenter.defaultOptions).statusBar.isHiddenOrDrawBehind() ? 0
|
|
144
|
+
int statusBarInset = resolveCurrentOptions(presenter.defaultOptions).statusBar.isHiddenOrDrawBehind() ? 0
|
|
145
|
+
: SystemUiUtils.getStatusBarHeight(getActivity());
|
|
149
146
|
final Integer perform = perform(getParentController(), 0, p -> p.getTopInset(this));
|
|
150
147
|
return statusBarInset + perform;
|
|
151
148
|
}
|
|
152
149
|
|
|
153
150
|
@Override
|
|
154
151
|
public void applyBottomInset() {
|
|
155
|
-
if (view != null
|
|
152
|
+
if (view != null)
|
|
153
|
+
presenter.applyBottomInset(view, getBottomInset());
|
|
156
154
|
}
|
|
157
155
|
|
|
158
156
|
@Override
|
|
159
157
|
protected WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat insets) {
|
|
160
|
-
ViewController<?> viewController = findController(view);
|
|
161
|
-
if (viewController == null || viewController.getView() == null || ignoreInsets) return insets;
|
|
162
|
-
final Options currentOptions = resolveCurrentOptions(presenter.defaultOptions);
|
|
163
|
-
int mode = getActivity().getWindow().getAttributes().softInputMode;
|
|
164
|
-
boolean adjustNothing = (mode & WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING) ==WindowManager.LayoutParams.SOFT_INPUT_ADJUST_NOTHING ;
|
|
165
|
-
final int keyboardBottomInset = currentOptions.layout.adjustResize.get(true) &&!adjustNothing ?
|
|
166
|
-
insets.getInsets(WindowInsetsCompat.Type.ime()).bottom : 0;
|
|
167
158
|
final Insets systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
159
|
+
int systemWindowInsetTop = insets.getInsets(WindowInsetsCompat.Type.statusBars()).top +
|
|
160
|
+
insets.getInsets(WindowInsetsCompat.Type.navigationBars()).top -
|
|
161
|
+
systemBarsInsets.top;
|
|
162
|
+
int systemWindowInsetBottom = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom +
|
|
163
|
+
insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom -
|
|
164
|
+
systemBarsInsets.bottom;
|
|
165
|
+
|
|
166
|
+
WindowInsetsCompat finalInsets = new WindowInsetsCompat.Builder()
|
|
167
|
+
.setInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.ime(),
|
|
168
|
+
Insets.of(systemBarsInsets.left,
|
|
169
|
+
systemWindowInsetTop,
|
|
170
|
+
systemBarsInsets.right,
|
|
171
|
+
Math.max(systemWindowInsetBottom - getBottomInset(), 0)))
|
|
172
|
+
.build();
|
|
173
|
+
ViewCompat.onApplyWindowInsets(view, finalInsets);
|
|
180
174
|
return insets;
|
|
181
175
|
}
|
|
182
176
|
|
|
@@ -197,15 +191,6 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
197
191
|
}
|
|
198
192
|
}
|
|
199
193
|
|
|
200
|
-
@Override
|
|
201
|
-
public ViewTooltip.TooltipView showAnchoredOverlay(@NonNull View anchorView, @NonNull OverlayAttachOptions overlayAttachOptions, @NonNull ViewController<?> overlayViewController) {
|
|
202
|
-
if (view != null) {
|
|
203
|
-
return view.getAttachedOverlayContainer().addAnchoredView(anchorView, overlayViewController.getView(),
|
|
204
|
-
overlayAttachOptions.gravity.get());
|
|
205
|
-
}
|
|
206
|
-
return null;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
194
|
@Override
|
|
210
195
|
public void onConfigurationChanged(Configuration newConfig) {
|
|
211
196
|
super.onConfigurationChanged(newConfig);
|
|
@@ -14,7 +14,6 @@ import com.reactnativenavigation.viewcontrollers.viewcontroller.overlay.ModalOve
|
|
|
14
14
|
|
|
15
15
|
import java.util.ArrayList;
|
|
16
16
|
import java.util.EmptyStackException;
|
|
17
|
-
import java.util.LinkedList;
|
|
18
17
|
import java.util.List;
|
|
19
18
|
|
|
20
19
|
import androidx.annotation.Nullable;
|
|
@@ -143,9 +142,6 @@ public class ModalStack {
|
|
|
143
142
|
public boolean isEmpty() {
|
|
144
143
|
return modals.isEmpty();
|
|
145
144
|
}
|
|
146
|
-
public List<ViewController<?>> getChildren(){
|
|
147
|
-
return new LinkedList<>(modals);
|
|
148
|
-
}
|
|
149
145
|
|
|
150
146
|
public int size() {
|
|
151
147
|
return modals.size();
|
|
@@ -82,9 +82,6 @@ public class Navigator extends ParentController<ViewGroup> {
|
|
|
82
82
|
rootLayout = new CoordinatorLayout(getActivity());
|
|
83
83
|
modalsLayout = new CoordinatorLayout(getActivity());
|
|
84
84
|
overlaysLayout = new CoordinatorLayout(getActivity());
|
|
85
|
-
overlayManager.setFindController(this::findController);
|
|
86
|
-
overlayManager.setFindAnchorView(this::findTooltipAnchorView);
|
|
87
|
-
overlayManager.setMainOverlayContainer(overlaysLayout);
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
|
|
@@ -127,7 +124,7 @@ public class Navigator extends ParentController<ViewGroup> {
|
|
|
127
124
|
|
|
128
125
|
public void destroyViews() {
|
|
129
126
|
modalStack.destroy();
|
|
130
|
-
overlayManager.destroy();
|
|
127
|
+
overlayManager.destroy(overlaysLayout);
|
|
131
128
|
destroyRoot();
|
|
132
129
|
}
|
|
133
130
|
|
|
@@ -214,27 +211,16 @@ public class Navigator extends ParentController<ViewGroup> {
|
|
|
214
211
|
modalStack.dismissAllModals(root, mergeOptions, listener);
|
|
215
212
|
}
|
|
216
213
|
|
|
217
|
-
@Override
|
|
218
|
-
public List<ViewController<?>> getChildren() {
|
|
219
|
-
final List<ViewController<?>> children = modalStack.getChildren();
|
|
220
|
-
children.add(root);
|
|
221
|
-
return children;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
214
|
public void showOverlay(ViewController<?> overlay, CommandListener listener) {
|
|
225
|
-
|
|
226
|
-
overlayManager.show( overlay,options.overlayOptions, listener);
|
|
227
|
-
|
|
215
|
+
overlayManager.show(overlaysLayout, overlay, listener);
|
|
228
216
|
}
|
|
229
217
|
|
|
230
218
|
public void dismissOverlay(final String componentId, CommandListener listener) {
|
|
231
|
-
overlayManager.dismiss( componentId, listener);
|
|
232
|
-
|
|
219
|
+
overlayManager.dismiss(overlaysLayout, componentId, listener);
|
|
233
220
|
}
|
|
234
221
|
|
|
235
222
|
public void dismissAllOverlays(CommandListener listener) {
|
|
236
|
-
overlayManager.dismissAll();
|
|
237
|
-
listener.onSuccess("");
|
|
223
|
+
overlayManager.dismissAll(overlaysLayout, listener);
|
|
238
224
|
}
|
|
239
225
|
|
|
240
226
|
@Nullable
|
|
@@ -288,7 +274,7 @@ public class Navigator extends ParentController<ViewGroup> {
|
|
|
288
274
|
overlayManager.onHostPause();
|
|
289
275
|
if (!modalStack.isEmpty()) {
|
|
290
276
|
modalStack.onHostPause();
|
|
291
|
-
if
|
|
277
|
+
if(modalStack.peekDisplayedOverCurrentContext()){
|
|
292
278
|
onViewDisappear();
|
|
293
279
|
}
|
|
294
280
|
} else {
|
|
@@ -300,7 +286,7 @@ public class Navigator extends ParentController<ViewGroup> {
|
|
|
300
286
|
overlayManager.onHostResume();
|
|
301
287
|
if (!modalStack.isEmpty()) {
|
|
302
288
|
modalStack.onHostResume();
|
|
303
|
-
if
|
|
289
|
+
if(modalStack.peekDisplayedOverCurrentContext()){
|
|
304
290
|
onViewDidAppear();
|
|
305
291
|
}
|
|
306
292
|
} else {
|