react-native-navigation 7.25.3 → 7.26.0-alpha.1
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/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/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/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 -54
- 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/dist/src/interfaces/Options.d.ts +0 -24
- package/lib/src/interfaces/Options.ts +0 -26
- 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
|
@@ -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;
|
|
@@ -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;
|
|
@@ -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,9 +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
6
|
|
|
8
|
-
import com.reactnativenavigation.
|
|
7
|
+
import com.reactnativenavigation.utils.LogKt;
|
|
9
8
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.ScrollEventListener;
|
|
10
9
|
import com.reactnativenavigation.options.Options;
|
|
11
10
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter;
|
|
@@ -14,11 +13,9 @@ import com.reactnativenavigation.viewcontrollers.viewcontroller.ReactViewCreator
|
|
|
14
13
|
import com.reactnativenavigation.viewcontrollers.child.ChildController;
|
|
15
14
|
import com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry;
|
|
16
15
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;
|
|
17
|
-
import com.reactnativenavigation.views.overlay.ViewTooltip;
|
|
18
16
|
import com.reactnativenavigation.views.component.ComponentLayout;
|
|
19
17
|
|
|
20
18
|
import androidx.annotation.NonNull;
|
|
21
|
-
import androidx.annotation.Nullable;
|
|
22
19
|
import androidx.core.graphics.Insets;
|
|
23
20
|
import androidx.core.view.ViewCompat;
|
|
24
21
|
import androidx.core.view.WindowInsetsCompat;
|
|
@@ -29,24 +26,21 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
29
26
|
private final String componentName;
|
|
30
27
|
private final ComponentPresenter presenter;
|
|
31
28
|
private final ReactViewCreator viewCreator;
|
|
32
|
-
private boolean ignoreInsets = false;
|
|
33
29
|
|
|
34
|
-
|
|
35
|
-
|
|
30
|
+
private enum VisibilityState {
|
|
31
|
+
Appear, Disappear
|
|
36
32
|
}
|
|
37
33
|
|
|
38
|
-
private enum VisibilityState {Appear, Disappear}
|
|
39
|
-
|
|
40
34
|
private VisibilityState lastVisibilityState = VisibilityState.Disappear;
|
|
41
35
|
|
|
42
36
|
public ComponentViewController(final Activity activity,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
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) {
|
|
50
44
|
super(activity, childRegistry, id, presenter, initialOptions);
|
|
51
45
|
this.componentName = componentName;
|
|
52
46
|
this.viewCreator = viewCreator;
|
|
@@ -55,7 +49,8 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
55
49
|
|
|
56
50
|
@Override
|
|
57
51
|
public void start() {
|
|
58
|
-
if (!isDestroyed())
|
|
52
|
+
if (!isDestroyed())
|
|
53
|
+
getView().start();
|
|
59
54
|
}
|
|
60
55
|
|
|
61
56
|
@Override
|
|
@@ -86,19 +81,19 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
86
81
|
if (view != null)
|
|
87
82
|
view.sendComponentWillStart();
|
|
88
83
|
super.onViewDidAppear();
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
view.sendComponentStart();
|
|
93
|
-
}
|
|
84
|
+
view.requestApplyInsets();
|
|
85
|
+
if (view != null && lastVisibilityState == VisibilityState.Disappear)
|
|
86
|
+
view.sendComponentStart();
|
|
94
87
|
lastVisibilityState = VisibilityState.Appear;
|
|
95
88
|
}
|
|
96
89
|
|
|
97
90
|
@Override
|
|
98
91
|
public void onViewDisappear() {
|
|
99
|
-
if (lastVisibilityState == VisibilityState.Disappear)
|
|
92
|
+
if (lastVisibilityState == VisibilityState.Disappear)
|
|
93
|
+
return;
|
|
100
94
|
lastVisibilityState = VisibilityState.Disappear;
|
|
101
|
-
if (view != null)
|
|
95
|
+
if (view != null)
|
|
96
|
+
view.sendComponentStop();
|
|
102
97
|
super.onViewDisappear();
|
|
103
98
|
}
|
|
104
99
|
|
|
@@ -109,7 +104,8 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
109
104
|
|
|
110
105
|
@Override
|
|
111
106
|
public void applyOptions(Options options) {
|
|
112
|
-
if (isRoot())
|
|
107
|
+
if (isRoot())
|
|
108
|
+
applyTopInset();
|
|
113
109
|
super.applyOptions(options);
|
|
114
110
|
getView().applyOptions(options);
|
|
115
111
|
presenter.applyOptions(getView(), resolveCurrentOptions(presenter.defaultOptions));
|
|
@@ -129,46 +125,51 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
129
125
|
|
|
130
126
|
@Override
|
|
131
127
|
public void mergeOptions(Options options) {
|
|
132
|
-
if (options == Options.EMPTY)
|
|
133
|
-
|
|
128
|
+
if (options == Options.EMPTY)
|
|
129
|
+
return;
|
|
130
|
+
if (isViewShown())
|
|
131
|
+
presenter.mergeOptions(getView(), options);
|
|
134
132
|
super.mergeOptions(options);
|
|
135
133
|
}
|
|
136
134
|
|
|
137
135
|
@Override
|
|
138
136
|
public void applyTopInset() {
|
|
139
|
-
if (view != null
|
|
137
|
+
if (view != null)
|
|
138
|
+
presenter.applyTopInsets(view, getTopInset());
|
|
140
139
|
}
|
|
141
140
|
|
|
142
141
|
@Override
|
|
143
142
|
public int getTopInset() {
|
|
144
|
-
int statusBarInset = resolveCurrentOptions(presenter.defaultOptions).statusBar.isHiddenOrDrawBehind() ? 0
|
|
143
|
+
int statusBarInset = resolveCurrentOptions(presenter.defaultOptions).statusBar.isHiddenOrDrawBehind() ? 0
|
|
144
|
+
: SystemUiUtils.getStatusBarHeight(getActivity());
|
|
145
145
|
final Integer perform = perform(getParentController(), 0, p -> p.getTopInset(this));
|
|
146
146
|
return statusBarInset + perform;
|
|
147
147
|
}
|
|
148
148
|
|
|
149
149
|
@Override
|
|
150
150
|
public void applyBottomInset() {
|
|
151
|
-
if (view != null
|
|
151
|
+
if (view != null)
|
|
152
|
+
presenter.applyBottomInset(view, getBottomInset());
|
|
152
153
|
}
|
|
153
154
|
|
|
154
155
|
@Override
|
|
155
156
|
protected WindowInsetsCompat onApplyWindowInsets(View view, WindowInsetsCompat insets) {
|
|
156
|
-
ViewController<?> viewController = findController(view);
|
|
157
|
-
if (viewController == null || viewController.getView() == null || ignoreInsets) return insets;
|
|
158
|
-
final Options currentOptions = resolveCurrentOptions(presenter.defaultOptions);
|
|
159
|
-
|
|
160
|
-
final int keyboardBottomInset = currentOptions.layout.adjustResize.get(true) ? insets.getInsets(WindowInsetsCompat.Type.ime()).bottom : 0;
|
|
161
157
|
final Insets systemBarsInsets = insets.getInsets(WindowInsetsCompat.Type.systemBars());
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
158
|
+
int systemWindowInsetTop = insets.getInsets(WindowInsetsCompat.Type.statusBars()).top +
|
|
159
|
+
insets.getInsets(WindowInsetsCompat.Type.navigationBars()).top -
|
|
160
|
+
systemBarsInsets.top;
|
|
161
|
+
int systemWindowInsetBottom = insets.getInsets(WindowInsetsCompat.Type.ime()).bottom +
|
|
162
|
+
insets.getInsets(WindowInsetsCompat.Type.navigationBars()).bottom -
|
|
163
|
+
systemBarsInsets.bottom;
|
|
164
|
+
|
|
165
|
+
WindowInsetsCompat finalInsets = new WindowInsetsCompat.Builder()
|
|
166
|
+
.setInsets(WindowInsetsCompat.Type.systemBars() | WindowInsetsCompat.Type.ime(),
|
|
167
|
+
Insets.of(systemBarsInsets.left,
|
|
168
|
+
systemWindowInsetTop,
|
|
169
|
+
systemBarsInsets.right,
|
|
170
|
+
Math.max(systemWindowInsetBottom - getBottomInset(), 0)))
|
|
171
|
+
.build();
|
|
172
|
+
ViewCompat.onApplyWindowInsets(view, finalInsets);
|
|
172
173
|
return insets;
|
|
173
174
|
}
|
|
174
175
|
|
|
@@ -189,15 +190,6 @@ public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
|
189
190
|
}
|
|
190
191
|
}
|
|
191
192
|
|
|
192
|
-
@Override
|
|
193
|
-
public ViewTooltip.TooltipView showAnchoredOverlay(@NonNull View anchorView, @NonNull OverlayAttachOptions overlayAttachOptions, @NonNull ViewController<?> overlayViewController) {
|
|
194
|
-
if (view != null) {
|
|
195
|
-
return view.getAttachedOverlayContainer().addAnchoredView(anchorView, overlayViewController.getView(),
|
|
196
|
-
overlayAttachOptions.gravity.get());
|
|
197
|
-
}
|
|
198
|
-
return null;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
193
|
@Override
|
|
202
194
|
public void onConfigurationChanged(Configuration newConfig) {
|
|
203
195
|
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 {
|