react-native-navigation 7.42.0-snapshot.1529 → 7.99.1-testbla
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 +15 -29
- package/lib/Mock/Components/LayoutComponent.tsx +2 -2
- package/lib/Mock/index.js +2 -2
- package/lib/android/app/build.gradle +0 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java +4 -20
- package/lib/android/app/src/main/java/com/reactnativenavigation/options/ValueAnimationOptions.kt +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/ReactView.java +3 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalHostLayout.kt +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java +2 -3
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactViewGroup.kt +2 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/SystemUiUtils.kt +10 -16
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ViewUtils.java +4 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsAnimator.kt +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/child/ChildController.java +14 -7
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/component/ComponentViewController.java +13 -37
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackController.java +11 -24
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/StackPresenter.java +10 -13
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/{TopBarAppearanceAnimator.kt → TopBarAnimator.kt} +2 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarCollapseBehavior.kt +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/topbar/TopBarController.kt +27 -122
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/LayoutDirectionApplier.kt +4 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/Presenter.java +6 -79
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/RootPresenter.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/ViewController.java +0 -5
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/{BaseViewAppearanceAnimator.kt → BaseViewAnimator.kt} +4 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/DefaultViewAnimatorCreator.kt +8 -8
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/ViewAnimatorCreator.kt +2 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/BackgroundColorAnimator.kt +4 -6
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/BackgroundColorEvaluator.kt +2 -4
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +6 -6
- package/lib/dist/Mock/Application.d.ts +6 -4
- package/lib/dist/Mock/Components/BottomTabs.d.ts +13 -9
- package/lib/dist/Mock/Components/ComponentScreen.d.ts +7 -5
- package/lib/dist/Mock/Components/ComponentScreen.js +3 -10
- package/lib/dist/Mock/Components/LayoutComponent.d.ts +13 -9
- package/lib/dist/Mock/Components/Modals.d.ts +13 -9
- package/lib/dist/Mock/Components/NavigationButton.d.ts +15 -11
- package/lib/dist/Mock/Components/Overlays.d.ts +13 -9
- package/lib/dist/Mock/Components/Stack.d.ts +13 -9
- package/lib/dist/Mock/Components/TopBar.d.ts +9 -7
- package/lib/dist/Mock/connect.js +1 -2
- package/lib/dist/Mock/index.js +2 -2
- package/lib/dist/src/adapters/NativeEventsReceiver.js +1 -1
- package/lib/dist/src/adapters/TouchablePreview.d.ts +2 -2
- package/lib/dist/src/commands/LayoutType.js +1 -1
- package/lib/dist/src/commands/OptionsProcessor.js +1 -8
- package/lib/dist/src/components/Modal.d.ts +1 -1
- package/lib/dist/src/interfaces/CommandName.js +1 -1
- package/lib/dist/src/interfaces/Options.d.ts +3 -33
- package/lib/dist/src/interfaces/Options.js +2 -2
- package/lib/dist/src/types.d.ts +0 -1
- package/lib/ios/BottomTabsBasePresenter.m +2 -3
- package/lib/ios/RNNAppDelegate.mm +2 -1
- package/lib/ios/RNNConvert.h +0 -2
- package/lib/ios/RNNConvert.m +0 -4
- package/lib/ios/RNNStackPresenter.m +2 -3
- package/lib/src/adapters/NativeEventsReceiver.ts +3 -3
- package/lib/src/adapters/TouchablePreview.tsx +3 -3
- package/lib/src/commands/OptionsProcessor.ts +2 -13
- package/lib/src/interfaces/Options.ts +3 -38
- package/package.json +31 -37
- package/lib/android/app/src/main/java/com/reactnativenavigation/FeatureToggles.kt +0 -60
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/StubAnimationListener.kt +0 -19
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/statusbar/StatusBarController.kt +0 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/stack/statusbar/StatusBarPresenter.kt +0 -9
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/ColorAnimator.kt +0 -22
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/animations/ViewBkgColorProperty.kt +0 -17
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
-
import { View, Text, TouchableOpacity, Image, ImageURISource
|
|
3
|
-
import { Navigation, ImageResource
|
|
2
|
+
import { View, Text, TouchableOpacity, Image, ImageURISource} from 'react-native';
|
|
3
|
+
import { Navigation, ImageResource} 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';
|
|
@@ -10,7 +10,8 @@ import { events } from '../Stores/EventsStore';
|
|
|
10
10
|
import _ from 'lodash';
|
|
11
11
|
import { switchTabByIndex } from '../actions/layoutActions';
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
|
|
14
|
+
function isURISource(src: ImageResource| undefined): src is ImageURISource {
|
|
14
15
|
return !!src && typeof src === 'object' && 'uri' in src;
|
|
15
16
|
}
|
|
16
17
|
|
|
@@ -35,15 +36,12 @@ export const ComponentScreen = connect(
|
|
|
35
36
|
if (bottomTabsOptions?.visible === false) return null;
|
|
36
37
|
const buttons = bottomTabs!.children!.map((child, i) => {
|
|
37
38
|
const bottomTabOptions = child.resolveOptions().bottomTab;
|
|
38
|
-
const icon =
|
|
39
|
-
(bottomTabs as any).selectedIndex === i
|
|
40
|
-
? bottomTabOptions?.selectedIcon
|
|
41
|
-
: bottomTabOptions?.icon;
|
|
39
|
+
const icon = (bottomTabs as any).selectedIndex === i ? bottomTabOptions?.selectedIcon : bottomTabOptions?.icon;
|
|
42
40
|
const iconURI = isURISource(icon) ? icon.uri : undefined;
|
|
43
41
|
return (
|
|
44
42
|
<View key={`tab-${i}`}>
|
|
45
43
|
<TouchableOpacity
|
|
46
|
-
style={{
|
|
44
|
+
style={{padding:10}}
|
|
47
45
|
testID={bottomTabOptions?.testID}
|
|
48
46
|
onPress={() => {
|
|
49
47
|
events.invokeBottomTabPressed({
|
|
@@ -53,34 +51,22 @@ export const ComponentScreen = connect(
|
|
|
53
51
|
switchTabByIndex(this.props.layoutNode.getBottomTabs(), i);
|
|
54
52
|
}}
|
|
55
53
|
>
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
source={{ uri: iconURI }}
|
|
62
|
-
/>
|
|
63
|
-
)}
|
|
64
|
-
<Text style={{ fontSize: 12 }}>{bottomTabOptions?.text || ''}</Text>
|
|
65
|
-
</View>
|
|
54
|
+
<View style={{justifyContent: 'center', alignItems: 'center'}}>
|
|
55
|
+
<Text>{bottomTabOptions?.badge}</Text>
|
|
56
|
+
{iconURI && <Image style={{width: 18, height: 18, marginBottom: 5}} source={{uri: iconURI}}/>}
|
|
57
|
+
<Text style={{fontSize: 12}}>{bottomTabOptions?.text || ''}</Text>
|
|
58
|
+
</View>
|
|
66
59
|
</TouchableOpacity>
|
|
67
60
|
</View>
|
|
68
61
|
);
|
|
69
62
|
});
|
|
70
63
|
|
|
71
64
|
return (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
flexDirection: 'row',
|
|
76
|
-
justifyContent: 'center',
|
|
77
|
-
width: '100%',
|
|
78
|
-
backgroundColor: '#F0F2F5',
|
|
79
|
-
}}
|
|
80
|
-
>
|
|
65
|
+
<View
|
|
66
|
+
testID={bottomTabsOptions?.testID}
|
|
67
|
+
style={{flexDirection: 'row',justifyContent: 'center', width: '100%', backgroundColor: '#F0F2F5'}}>
|
|
81
68
|
{buttons}
|
|
82
|
-
|
|
83
|
-
);
|
|
69
|
+
</View>);
|
|
84
70
|
}
|
|
85
71
|
|
|
86
72
|
render() {
|
|
@@ -19,8 +19,8 @@ export const LayoutComponent = class extends Component<ComponentProps> {
|
|
|
19
19
|
return <View />;
|
|
20
20
|
}
|
|
21
21
|
componentDidCatch(error: Error, errorInfo: React.ErrorInfo) {
|
|
22
|
-
const err =
|
|
23
|
-
`Error while trying to render layout ${this.props.layoutNode.nodeId} of type ${this.props.layoutNode.type}: ${error}\n${errorInfo?.componentStack}
|
|
22
|
+
const err = new Error(
|
|
23
|
+
`Error while trying to render layout ${this.props.layoutNode.nodeId} of type ${this.props.layoutNode.type}: ${error}\n${errorInfo?.componentStack}`,
|
|
24
24
|
);
|
|
25
25
|
(err as any).cause = error;
|
|
26
26
|
throw err;
|
package/lib/Mock/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.ApplicationMock = void 0;
|
|
4
|
+
exports.mockNativeComponents = mockNativeComponents;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
exports.ApplicationMock = require('./Application').Application;
|
|
6
7
|
tslib_1.__exportStar(require("./constants"), exports);
|
|
@@ -11,4 +12,3 @@ function mockNativeComponents() {
|
|
|
11
12
|
const { Navigation } = require('react-native-navigation');
|
|
12
13
|
Navigation.mockNativeComponents(new NativeCommandsSender(), new NativeEventsReceiver(), new AppRegistryService());
|
|
13
14
|
}
|
|
14
|
-
exports.mockNativeComponents = mockNativeComponents;
|
|
@@ -20,7 +20,6 @@ def DEFAULT_KOTLIN_STDLIB = 'kotlin-stdlib-jdk8'
|
|
|
20
20
|
def kotlinVersion = safeExtGet("RNNKotlinVersion", DEFAULT_KOTLIN_VERSION)
|
|
21
21
|
def kotlinStdlib = safeExtGet('RNNKotlinStdlib',DEFAULT_KOTLIN_STDLIB )
|
|
22
22
|
def kotlinCoroutinesCore = safeExtGet('RNNKotlinCoroutinesCore', '1.5.2')
|
|
23
|
-
|
|
24
23
|
android {
|
|
25
24
|
namespace 'com.reactnativenavigation'
|
|
26
25
|
compileSdkVersion safeExtGetFallbackLowerBound('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
|
|
@@ -4,13 +4,10 @@ import android.app.Application;
|
|
|
4
4
|
|
|
5
5
|
import com.facebook.react.ReactApplication;
|
|
6
6
|
import com.facebook.react.ReactNativeHost;
|
|
7
|
-
import com.facebook.react.soloader.OpenSourceMergedSoMapping;
|
|
8
7
|
import com.facebook.soloader.SoLoader;
|
|
9
8
|
import com.reactnativenavigation.react.ReactGateway;
|
|
10
9
|
import com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentCreator;
|
|
11
10
|
|
|
12
|
-
import java.util.Collections;
|
|
13
|
-
import java.io.IOException;
|
|
14
11
|
import java.util.HashMap;
|
|
15
12
|
import java.util.Map;
|
|
16
13
|
|
|
@@ -18,28 +15,15 @@ import androidx.annotation.NonNull;
|
|
|
18
15
|
|
|
19
16
|
public abstract class NavigationApplication extends Application implements ReactApplication {
|
|
20
17
|
|
|
21
|
-
public static NavigationApplication instance;
|
|
22
|
-
|
|
23
|
-
private final Map<String, ExternalComponentCreator> externalComponents = new HashMap<>();
|
|
24
18
|
private ReactGateway reactGateway;
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
this(Collections.emptyMap());
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
public NavigationApplication(Map<RNNToggles, Boolean> featureToggleOverrides) {
|
|
31
|
-
instance = this;
|
|
32
|
-
RNNFeatureToggles.init(featureToggleOverrides);
|
|
33
|
-
}
|
|
19
|
+
public static NavigationApplication instance;
|
|
20
|
+
final Map<String, ExternalComponentCreator> externalComponents = new HashMap<>();
|
|
34
21
|
|
|
35
22
|
@Override
|
|
36
23
|
public void onCreate() {
|
|
37
24
|
super.onCreate();
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
} catch (IOException e) {
|
|
41
|
-
throw new RuntimeException(e);
|
|
42
|
-
}
|
|
25
|
+
instance = this;
|
|
26
|
+
SoLoader.init(this, false);
|
|
43
27
|
reactGateway = createReactGateway();
|
|
44
28
|
}
|
|
45
29
|
|
package/lib/android/app/src/main/java/com/reactnativenavigation/options/ValueAnimationOptions.kt
CHANGED
|
@@ -50,9 +50,9 @@ class ValueAnimationOptions {
|
|
|
50
50
|
to += this.to[animationValueAccessor!!(view)]
|
|
51
51
|
}
|
|
52
52
|
val animator = ObjectAnimator.ofFloat(view,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
animProp,
|
|
54
|
+
from,
|
|
55
|
+
to
|
|
56
56
|
)
|
|
57
57
|
animator.interpolator = interpolator
|
|
58
58
|
if (duration.hasValue()) animator.duration = duration.get().toLong()
|
|
@@ -5,8 +5,6 @@ import android.content.Context;
|
|
|
5
5
|
import android.os.Bundle;
|
|
6
6
|
import android.view.MotionEvent;
|
|
7
7
|
|
|
8
|
-
import androidx.annotation.RestrictTo;
|
|
9
|
-
|
|
10
8
|
import com.facebook.react.ReactInstanceManager;
|
|
11
9
|
import com.facebook.react.ReactRootView;
|
|
12
10
|
import com.facebook.react.bridge.ReactContext;
|
|
@@ -14,12 +12,14 @@ import com.facebook.react.config.ReactFeatureFlags;
|
|
|
14
12
|
import com.facebook.react.uimanager.JSTouchDispatcher;
|
|
15
13
|
import com.facebook.react.uimanager.UIManagerModule;
|
|
16
14
|
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
15
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.ScrollEventListener;
|
|
17
16
|
import com.reactnativenavigation.react.events.ComponentType;
|
|
18
17
|
import com.reactnativenavigation.react.events.EventEmitter;
|
|
19
18
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.IReactView;
|
|
20
|
-
import com.reactnativenavigation.viewcontrollers.viewcontroller.ScrollEventListener;
|
|
21
19
|
import com.reactnativenavigation.views.component.Renderable;
|
|
22
20
|
|
|
21
|
+
import androidx.annotation.RestrictTo;
|
|
22
|
+
|
|
23
23
|
@SuppressLint("ViewConstructor")
|
|
24
24
|
public class ReactView extends ReactRootView implements IReactView, Renderable {
|
|
25
25
|
|
package/lib/android/app/src/main/java/com/reactnativenavigation/react/modal/ModalHostLayout.kt
CHANGED
|
@@ -34,7 +34,7 @@ open class ModalHostLayout(reactContext: ThemedReactContext) : ViewGroup(reactCo
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
@TargetApi(23)
|
|
37
|
-
override fun dispatchProvideStructure(structure: ViewStructure) {
|
|
37
|
+
override fun dispatchProvideStructure(structure: ViewStructure?) {
|
|
38
38
|
mHostView.dispatchProvideStructure(structure)
|
|
39
39
|
}
|
|
40
40
|
|
package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactTypefaceUtils.java
CHANGED
|
@@ -18,7 +18,6 @@ import android.graphics.Typeface;
|
|
|
18
18
|
import android.text.TextUtils;
|
|
19
19
|
import androidx.annotation.Nullable;
|
|
20
20
|
import com.facebook.react.bridge.ReadableArray;
|
|
21
|
-
import com.facebook.react.common.ReactConstants;
|
|
22
21
|
import com.facebook.react.views.text.ReactFontManager;
|
|
23
22
|
import com.facebook.react.views.text.ReactTextShadowNode;
|
|
24
23
|
import java.util.ArrayList;
|
|
@@ -97,12 +96,12 @@ public class ReactTypefaceUtils {
|
|
|
97
96
|
|
|
98
97
|
int want = 0;
|
|
99
98
|
if ((weight == Typeface.BOLD)
|
|
100
|
-
|| ((oldStyle & Typeface.BOLD) != 0 && weight ==
|
|
99
|
+
|| ((oldStyle & Typeface.BOLD) != 0 && weight == ReactTextShadowNode.UNSET)) {
|
|
101
100
|
want |= Typeface.BOLD;
|
|
102
101
|
}
|
|
103
102
|
|
|
104
103
|
if ((style == Typeface.ITALIC)
|
|
105
|
-
|| ((oldStyle & Typeface.ITALIC) != 0 && style ==
|
|
104
|
+
|| ((oldStyle & Typeface.ITALIC) != 0 && style == ReactTextShadowNode.UNSET)) {
|
|
106
105
|
want |= Typeface.ITALIC;
|
|
107
106
|
}
|
|
108
107
|
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
package com.reactnativenavigation.utils
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.
|
|
4
|
-
import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable
|
|
3
|
+
import com.facebook.react.views.view.ReactViewBackgroundDrawable
|
|
5
4
|
import com.facebook.react.views.view.ReactViewGroup
|
|
6
5
|
|
|
7
|
-
@OptIn(UnstableReactNativeAPI::class)
|
|
8
6
|
val ReactViewGroup.borderRadius: Float
|
|
9
|
-
get() = (background as?
|
|
7
|
+
get() = (background as? ReactViewBackgroundDrawable)?.fullBorderRadius ?: 0f
|
|
@@ -121,25 +121,19 @@ object SystemUiUtils {
|
|
|
121
121
|
@ColorInt color: Int,
|
|
122
122
|
translucent: Boolean
|
|
123
123
|
) {
|
|
124
|
-
val opaqueColor =
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
}
|
|
124
|
+
val opaqueColor = if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) {
|
|
125
|
+
Color.BLACK
|
|
126
|
+
}else{
|
|
127
|
+
val colorAlpha = Color.alpha(color)
|
|
128
|
+
val alpha = if (translucent && colorAlpha == 255) STATUS_BAR_HEIGHT_TRANSLUCENCY else colorAlpha/255.0f
|
|
129
|
+
val red: Int = Color.red(color)
|
|
130
|
+
val green: Int = Color.green(color)
|
|
131
|
+
val blue: Int = Color.blue(color)
|
|
132
|
+
Color.argb(ceil(alpha * 255).toInt(), red, green, blue)
|
|
133
|
+
}
|
|
135
134
|
window?.statusBarColor = opaqueColor
|
|
136
135
|
}
|
|
137
136
|
|
|
138
|
-
@JvmStatic
|
|
139
|
-
fun getStatusBarColor(window: Window?): Int? {
|
|
140
|
-
return window?.statusBarColor
|
|
141
|
-
}
|
|
142
|
-
|
|
143
137
|
@JvmStatic
|
|
144
138
|
fun hideStatusBar(window: Window?, view: View) {
|
|
145
139
|
window?.let {
|
|
@@ -5,6 +5,8 @@ import android.view.View;
|
|
|
5
5
|
import android.view.ViewGroup;
|
|
6
6
|
import android.view.ViewParent;
|
|
7
7
|
|
|
8
|
+
import com.facebook.react.views.view.ReactViewBackgroundDrawable;
|
|
9
|
+
|
|
8
10
|
import java.util.ArrayList;
|
|
9
11
|
import java.util.List;
|
|
10
12
|
|
|
@@ -12,9 +14,6 @@ import androidx.annotation.Nullable;
|
|
|
12
14
|
|
|
13
15
|
import static com.reactnativenavigation.utils.ObjectUtils.perform;
|
|
14
16
|
|
|
15
|
-
import com.facebook.react.common.annotations.UnstableReactNativeAPI;
|
|
16
|
-
import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable;
|
|
17
|
-
|
|
18
17
|
public class ViewUtils {
|
|
19
18
|
@Nullable
|
|
20
19
|
public static <T extends View> T findChildByClass(ViewGroup root, Class<T> clazz) {
|
|
@@ -108,10 +107,9 @@ public class ViewUtils {
|
|
|
108
107
|
return ((ViewGroup) parent).indexOfChild(view);
|
|
109
108
|
}
|
|
110
109
|
|
|
111
|
-
@UnstableReactNativeAPI
|
|
112
110
|
public static int getBackgroundColor(View view) {
|
|
113
|
-
if (view.getBackground() instanceof
|
|
114
|
-
return ((
|
|
111
|
+
if (view.getBackground() instanceof ReactViewBackgroundDrawable) {
|
|
112
|
+
return ((ReactViewBackgroundDrawable) view.getBackground()).getColor();
|
|
115
113
|
}
|
|
116
114
|
throw new RuntimeException(view.getBackground().getClass().getSimpleName() + " is not ReactViewBackgroundDrawable");
|
|
117
115
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
package com.reactnativenavigation.viewcontrollers.bottomtabs
|
|
2
2
|
|
|
3
|
-
import com.reactnativenavigation.views.animations.
|
|
3
|
+
import com.reactnativenavigation.views.animations.BaseViewAnimator
|
|
4
4
|
import com.reactnativenavigation.views.bottomtabs.BottomTabs
|
|
5
5
|
|
|
6
|
-
class BottomTabsAnimator(view: BottomTabs? = null) :
|
|
6
|
+
class BottomTabsAnimator(view: BottomTabs? = null) : BaseViewAnimator<BottomTabs>(HideDirection.Down, view) {
|
|
7
7
|
override fun onShowAnimationEnd() {
|
|
8
8
|
view.restoreBottomNavigation(false)
|
|
9
9
|
}
|
|
@@ -2,23 +2,30 @@ 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;
|
|
23
30
|
|
|
24
31
|
public ChildControllersRegistry getChildRegistry() {
|
|
@@ -1,29 +1,28 @@
|
|
|
1
1
|
package com.reactnativenavigation.viewcontrollers.component;
|
|
2
2
|
|
|
3
|
-
import static com.reactnativenavigation.utils.ObjectUtils.perform;
|
|
4
|
-
|
|
5
|
-
import android.animation.Animator;
|
|
6
3
|
import android.app.Activity;
|
|
7
4
|
import android.content.res.Configuration;
|
|
8
5
|
import android.view.View;
|
|
9
6
|
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import androidx.core.graphics.Insets;
|
|
13
|
-
import androidx.core.view.ViewCompat;
|
|
14
|
-
import androidx.core.view.WindowInsetsCompat;
|
|
15
|
-
|
|
7
|
+
import com.reactnativenavigation.utils.LogKt;
|
|
8
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.ScrollEventListener;
|
|
16
9
|
import com.reactnativenavigation.options.Options;
|
|
10
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter;
|
|
17
11
|
import com.reactnativenavigation.utils.SystemUiUtils;
|
|
12
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.ReactViewCreator;
|
|
18
13
|
import com.reactnativenavigation.viewcontrollers.child.ChildController;
|
|
19
14
|
import com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry;
|
|
20
|
-
import com.reactnativenavigation.viewcontrollers.
|
|
21
|
-
import com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter;
|
|
22
|
-
import com.reactnativenavigation.viewcontrollers.viewcontroller.ReactViewCreator;
|
|
23
|
-
import com.reactnativenavigation.viewcontrollers.viewcontroller.ScrollEventListener;
|
|
15
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.ViewController;
|
|
24
16
|
import com.reactnativenavigation.views.component.ComponentLayout;
|
|
25
17
|
|
|
26
|
-
|
|
18
|
+
import androidx.annotation.NonNull;
|
|
19
|
+
import androidx.core.graphics.Insets;
|
|
20
|
+
import androidx.core.view.ViewCompat;
|
|
21
|
+
import androidx.core.view.WindowInsetsCompat;
|
|
22
|
+
|
|
23
|
+
import static com.reactnativenavigation.utils.ObjectUtils.perform;
|
|
24
|
+
|
|
25
|
+
public class ComponentViewController extends ChildController<ComponentLayout> {
|
|
27
26
|
private final String componentName;
|
|
28
27
|
private final ComponentPresenter presenter;
|
|
29
28
|
private final ReactViewCreator viewCreator;
|
|
@@ -65,29 +64,6 @@ public class ComponentViewController extends ChildController<ComponentLayout> im
|
|
|
65
64
|
presenter.setDefaultOptions(defaultOptions);
|
|
66
65
|
}
|
|
67
66
|
|
|
68
|
-
@Override
|
|
69
|
-
public StatusBarController getStatusBarController() {
|
|
70
|
-
return this;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
@Nullable
|
|
74
|
-
@Override
|
|
75
|
-
public Animator getStatusBarPushAnimation(@NonNull Options appearingOptions) {
|
|
76
|
-
if (super.presenter != null) {
|
|
77
|
-
return super.presenter.getStatusBarPushAnimation(appearingOptions);
|
|
78
|
-
}
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
@Nullable
|
|
83
|
-
@Override
|
|
84
|
-
public Animator getStatusBarPopAnimation(@NonNull Options appearingOptions, @NonNull Options disappearingOptions) {
|
|
85
|
-
if (super.presenter != null) {
|
|
86
|
-
return super.presenter.getStatusBarPopAnimation(appearingOptions, disappearingOptions);
|
|
87
|
-
}
|
|
88
|
-
return null;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
67
|
@Override
|
|
92
68
|
public ScrollEventListener getScrollEventListener() {
|
|
93
69
|
return perform(view, null, ComponentLayout::getScrollEventListener);
|
|
@@ -159,19 +159,16 @@ public class StackController extends ParentController<StackLayout> {
|
|
|
159
159
|
listener.onError("A stack can't contain two children with the same id: " + child.getId());
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
}
|
|
168
|
-
|
|
162
|
+
final ViewController<?> toRemove = stack.peek();
|
|
163
|
+
if (size() > 0) backButtonHelper.addToPushedChild(child);
|
|
164
|
+
child.setParentController(this);
|
|
165
|
+
stack.push(child.getId(), child);
|
|
166
|
+
if (!isViewCreated()) return;
|
|
169
167
|
Options resolvedOptions = resolveCurrentOptions(presenter.getDefaultOptions());
|
|
170
|
-
|
|
171
|
-
|
|
168
|
+
addChildToStack(child, resolvedOptions);
|
|
172
169
|
if (toRemove != null) {
|
|
173
|
-
StackAnimationOptions
|
|
174
|
-
if (
|
|
170
|
+
StackAnimationOptions animation = resolvedOptions.animations.push;
|
|
171
|
+
if (animation.enabled.isTrueOrUndefined()) {
|
|
175
172
|
animator.push(
|
|
176
173
|
child,
|
|
177
174
|
toRemove,
|
|
@@ -198,17 +195,7 @@ public class StackController extends ParentController<StackLayout> {
|
|
|
198
195
|
listener.onSuccess(toAdd.getId());
|
|
199
196
|
}
|
|
200
197
|
|
|
201
|
-
private
|
|
202
|
-
final ViewController<?> toRemove = stack.peek();
|
|
203
|
-
|
|
204
|
-
if (size() > 0) backButtonHelper.addToPushedChild(child);
|
|
205
|
-
|
|
206
|
-
child.setParentController(this);
|
|
207
|
-
stack.push(child.getId(), child);
|
|
208
|
-
return toRemove;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
private void updateChildLayout(ViewController<?> child, Options resolvedOptions) {
|
|
198
|
+
private void addChildToStack(ViewController<?> child, Options resolvedOptions) {
|
|
212
199
|
child.setWaitForRender(resolvedOptions.animations.push.waitForRender);
|
|
213
200
|
if (size() == 1) presenter.applyInitialChildLayoutOptions(resolvedOptions);
|
|
214
201
|
getView().addView(child.getView(), getView().getChildCount() - 1, matchParentWithBehaviour(new StackBehaviour(this)));
|
|
@@ -235,7 +222,7 @@ public class StackController extends ParentController<StackLayout> {
|
|
|
235
222
|
child.setParentController(this);
|
|
236
223
|
stack.push(child.getId(), child);
|
|
237
224
|
Options resolvedOptions = resolveCurrentOptions(presenter.getDefaultOptions());
|
|
238
|
-
|
|
225
|
+
addChildToStack(child, resolvedOptions);
|
|
239
226
|
|
|
240
227
|
CommandListener listenerAdapter = new CommandListenerAdapter() {
|
|
241
228
|
@Override
|
|
@@ -329,7 +316,7 @@ public class StackController extends ParentController<StackLayout> {
|
|
|
329
316
|
appearing,
|
|
330
317
|
disappearing,
|
|
331
318
|
disappearingOptions,
|
|
332
|
-
presenter.getAdditionalPopAnimations(appearingOptions, disappearingOptions
|
|
319
|
+
presenter.getAdditionalPopAnimations(appearingOptions, disappearingOptions),
|
|
333
320
|
() -> finishPopping(appearing, disappearing, listener)
|
|
334
321
|
);
|
|
335
322
|
} else {
|
|
@@ -233,7 +233,7 @@ public class StackPresenter {
|
|
|
233
233
|
|
|
234
234
|
topBar.setBorderHeight(topBarOptions.borderHeight.get(0d));
|
|
235
235
|
topBar.setBorderColor(topBarOptions.borderColor.get(DEFAULT_BORDER_COLOR));
|
|
236
|
-
|
|
236
|
+
topBar.setBackgroundColor(topBarOptions.background.color.get(Color.WHITE));
|
|
237
237
|
|
|
238
238
|
if (topBarOptions.background.component.hasValue()) {
|
|
239
239
|
View createdComponent = findBackgroundComponent(topBarOptions.background.component);
|
|
@@ -417,23 +417,18 @@ public class StackPresenter {
|
|
|
417
417
|
}
|
|
418
418
|
}
|
|
419
419
|
|
|
420
|
-
public List<Animator> getAdditionalPushAnimations(
|
|
421
|
-
StackController stack,
|
|
422
|
-
ViewController<?> appearingCtrl,
|
|
420
|
+
public List<Animator> getAdditionalPushAnimations(StackController stack, ViewController<?> appearing,
|
|
423
421
|
Options appearingOptions) {
|
|
424
422
|
return CollectionUtils.asList(
|
|
425
|
-
topBarController.getPushAnimation(appearingOptions,
|
|
426
|
-
|
|
427
|
-
perform(bottomTabsController, null, btc -> btc.getPushAnimation(appearingOptions))
|
|
428
|
-
);
|
|
423
|
+
topBarController.getPushAnimation(appearingOptions,
|
|
424
|
+
getTopBarTranslationAnimationDelta(stack, appearing)),
|
|
425
|
+
perform(bottomTabsController, null, btc -> btc.getPushAnimation(appearingOptions)));
|
|
429
426
|
}
|
|
430
427
|
|
|
431
|
-
public List<Animator> getAdditionalPopAnimations(Options appearingOptions, Options disappearingOptions
|
|
428
|
+
public List<Animator> getAdditionalPopAnimations(Options appearingOptions, Options disappearingOptions) {
|
|
432
429
|
return CollectionUtils.asList(
|
|
433
430
|
topBarController.getPopAnimation(appearingOptions, disappearingOptions),
|
|
434
|
-
perform(
|
|
435
|
-
perform(bottomTabsController, null, btc -> btc.getPopAnimation(appearingOptions, disappearingOptions))
|
|
436
|
-
);
|
|
431
|
+
perform(bottomTabsController, null, btc -> btc.getPopAnimation(appearingOptions, disappearingOptions)));
|
|
437
432
|
}
|
|
438
433
|
|
|
439
434
|
public List<Animator> getAdditionalSetRootAnimations(StackController stack, ViewController<?> appearing,
|
|
@@ -623,7 +618,9 @@ public class StackPresenter {
|
|
|
623
618
|
if (resolveOptions.subtitle.font.hasValue()) {
|
|
624
619
|
topBar.setSubtitleTypeface(typefaceLoader, resolveOptions.subtitle.font);
|
|
625
620
|
}
|
|
626
|
-
|
|
621
|
+
|
|
622
|
+
if (topBarOptions.background.color.hasValue())
|
|
623
|
+
topBar.setBackgroundColor(topBarOptions.background.color.get());
|
|
627
624
|
|
|
628
625
|
if (topBarOptions.background.component.hasValue()) {
|
|
629
626
|
if (backgroundControllers.containsKey(component)) {
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
package com.reactnativenavigation.viewcontrollers.stack.topbar
|
|
2
2
|
|
|
3
|
-
import com.reactnativenavigation.views.animations.
|
|
3
|
+
import com.reactnativenavigation.views.animations.BaseViewAnimator
|
|
4
4
|
import com.reactnativenavigation.views.stack.topbar.TopBar
|
|
5
5
|
|
|
6
|
-
class
|
|
7
|
-
: BaseViewAppearanceAnimator<TopBar>(HideDirection.Up, view) {
|
|
8
|
-
|
|
6
|
+
class TopBarAnimator @JvmOverloads constructor(view: TopBar? = null) : BaseViewAnimator<TopBar>(HideDirection.Up, view) {
|
|
9
7
|
@Suppress("UNUSED_PARAMETER")
|
|
10
8
|
fun hideOnScroll(translationStart: Float, translationEndDy: Float) {
|
|
11
9
|
// NOOP for now - this entire mechanism needs to be reimplemented as it relies on bridge events which are obsolete in TurboModules config
|
|
@@ -7,7 +7,7 @@ import com.reactnativenavigation.views.stack.topbar.TopBar
|
|
|
7
7
|
|
|
8
8
|
class TopBarCollapseBehavior(private val topBar: TopBar) : ScrollEventListener.OnScrollListener, ScrollEventListener.OnDragListener {
|
|
9
9
|
private var scrollEventListener: ScrollEventListener? = null
|
|
10
|
-
private val animator:
|
|
10
|
+
private val animator: TopBarAnimator = TopBarAnimator(topBar)
|
|
11
11
|
|
|
12
12
|
fun enableCollapse(scrollEventListener: ScrollEventListener?) {
|
|
13
13
|
this.scrollEventListener = scrollEventListener
|