react-native-navigation 7.40.3 → 7.41.0-rc01
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 +29 -15
- package/lib/Mock/Components/LayoutComponent.tsx +2 -2
- package/lib/Mock/Stores/EventsStore.ts +9 -0
- package/lib/Mock/index.js +2 -2
- package/lib/Mock/mocks/NativeCommandsSender.tsx +3 -0
- package/lib/Mock/mocks/NativeEventsReceiver.ts +2 -1
- package/lib/android/app/build.gradle +1 -0
- package/lib/android/app/src/main/java/com/reactnativenavigation/NavigationApplication.java +7 -1
- 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 +3 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ReactViewGroup.kt +4 -2
- package/lib/android/app/src/main/java/com/reactnativenavigation/utils/ViewUtils.java +6 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/LayoutDirectionApplier.kt +8 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/viewcontroller/RootPresenter.java +1 -1
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/BackgroundColorAnimator.kt +6 -4
- package/lib/android/app/src/main/java/com/reactnativenavigation/views/element/animators/BackgroundColorEvaluator.kt +4 -2
- package/lib/android/app/src/reactNative71/java/com/reactnativenavigation/react/modal/ModalContentLayout.kt +6 -6
- package/lib/dist/Mock/Application.d.ts +4 -6
- package/lib/dist/Mock/Components/BottomTabs.d.ts +9 -13
- package/lib/dist/Mock/Components/ComponentScreen.d.ts +5 -7
- package/lib/dist/Mock/Components/ComponentScreen.js +10 -3
- package/lib/dist/Mock/Components/LayoutComponent.d.ts +9 -13
- package/lib/dist/Mock/Components/Modals.d.ts +9 -13
- package/lib/dist/Mock/Components/NavigationButton.d.ts +11 -15
- package/lib/dist/Mock/Components/Overlays.d.ts +9 -13
- package/lib/dist/Mock/Components/Stack.d.ts +9 -13
- package/lib/dist/Mock/Components/TopBar.d.ts +7 -9
- package/lib/dist/Mock/Stores/EventsStore.d.ts +3 -1
- package/lib/dist/Mock/Stores/EventsStore.js +7 -0
- package/lib/dist/Mock/connect.js +2 -1
- package/lib/dist/Mock/index.js +2 -2
- package/lib/dist/Mock/mocks/NativeCommandsSender.js +3 -0
- package/lib/dist/Mock/mocks/NativeEventsReceiver.d.ts +1 -1
- package/lib/dist/Mock/mocks/NativeEventsReceiver.js +2 -1
- 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/components/Modal.d.ts +1 -1
- package/lib/dist/src/interfaces/CommandName.js +1 -1
- package/lib/dist/src/interfaces/Options.js +2 -2
- package/lib/dist/src/types.d.ts +1 -0
- package/lib/ios/BottomTabsBasePresenter.m +3 -2
- package/lib/ios/RNNAppDelegate.mm +1 -2
- package/lib/ios/RNNConvert.h +3 -0
- package/lib/ios/RNNConvert.m +9 -0
- package/lib/ios/RNNStackPresenter.m +3 -2
- package/lib/src/adapters/NativeEventsReceiver.ts +3 -3
- package/lib/src/adapters/TouchablePreview.tsx +3 -3
- package/package.json +37 -31
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { Component } from 'react';
|
|
2
|
-
import { View, Text, TouchableOpacity, Image, ImageURISource} from 'react-native';
|
|
3
|
-
import { Navigation, ImageResource} from 'react-native-navigation';
|
|
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,8 +10,7 @@ import { events } from '../Stores/EventsStore';
|
|
|
10
10
|
import _ from 'lodash';
|
|
11
11
|
import { switchTabByIndex } from '../actions/layoutActions';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
function isURISource(src: ImageResource| undefined): src is ImageURISource {
|
|
13
|
+
function isURISource(src: ImageResource | undefined): src is ImageURISource {
|
|
15
14
|
return !!src && typeof src === 'object' && 'uri' in src;
|
|
16
15
|
}
|
|
17
16
|
|
|
@@ -36,12 +35,15 @@ export const ComponentScreen = connect(
|
|
|
36
35
|
if (bottomTabsOptions?.visible === false) return null;
|
|
37
36
|
const buttons = bottomTabs!.children!.map((child, i) => {
|
|
38
37
|
const bottomTabOptions = child.resolveOptions().bottomTab;
|
|
39
|
-
const icon =
|
|
38
|
+
const icon =
|
|
39
|
+
(bottomTabs as any).selectedIndex === i
|
|
40
|
+
? bottomTabOptions?.selectedIcon
|
|
41
|
+
: bottomTabOptions?.icon;
|
|
40
42
|
const iconURI = isURISource(icon) ? icon.uri : undefined;
|
|
41
43
|
return (
|
|
42
44
|
<View key={`tab-${i}`}>
|
|
43
45
|
<TouchableOpacity
|
|
44
|
-
style={{padding:10}}
|
|
46
|
+
style={{ padding: 10 }}
|
|
45
47
|
testID={bottomTabOptions?.testID}
|
|
46
48
|
onPress={() => {
|
|
47
49
|
events.invokeBottomTabPressed({
|
|
@@ -51,22 +53,34 @@ export const ComponentScreen = connect(
|
|
|
51
53
|
switchTabByIndex(this.props.layoutNode.getBottomTabs(), i);
|
|
52
54
|
}}
|
|
53
55
|
>
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
56
|
+
<View style={{ justifyContent: 'center', alignItems: 'center' }}>
|
|
57
|
+
<Text>{bottomTabOptions?.badge}</Text>
|
|
58
|
+
{iconURI && (
|
|
59
|
+
<Image
|
|
60
|
+
style={{ width: 18, height: 18, marginBottom: 5 }}
|
|
61
|
+
source={{ uri: iconURI }}
|
|
62
|
+
/>
|
|
63
|
+
)}
|
|
64
|
+
<Text style={{ fontSize: 12 }}>{bottomTabOptions?.text || ''}</Text>
|
|
65
|
+
</View>
|
|
59
66
|
</TouchableOpacity>
|
|
60
67
|
</View>
|
|
61
68
|
);
|
|
62
69
|
});
|
|
63
70
|
|
|
64
71
|
return (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
72
|
+
<View
|
|
73
|
+
testID={bottomTabsOptions?.testID}
|
|
74
|
+
style={{
|
|
75
|
+
flexDirection: 'row',
|
|
76
|
+
justifyContent: 'center',
|
|
77
|
+
width: '100%',
|
|
78
|
+
backgroundColor: '#F0F2F5',
|
|
79
|
+
}}
|
|
80
|
+
>
|
|
68
81
|
{buttons}
|
|
69
|
-
|
|
82
|
+
</View>
|
|
83
|
+
);
|
|
70
84
|
}
|
|
71
85
|
|
|
72
86
|
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;
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
ComponentDidDisappearEvent,
|
|
3
3
|
ComponentWillAppearEvent,
|
|
4
4
|
ModalDismissedEvent,
|
|
5
|
+
ScreenPoppedEvent,
|
|
5
6
|
} from '../../src/interfaces/ComponentEvents';
|
|
6
7
|
import { ComponentDidAppearEvent, NavigationButtonPressedEvent } from '../../src/index';
|
|
7
8
|
import { BottomTabPressedEvent, CommandCompletedEvent } from '../../src/interfaces/Events';
|
|
@@ -14,6 +15,8 @@ export const events = {
|
|
|
14
15
|
modalDismissed: [(_event: ModalDismissedEvent) => {}],
|
|
15
16
|
bottomTabPressed: [(_event: BottomTabPressedEvent) => {}],
|
|
16
17
|
commandCompleted: [(_event: CommandCompletedEvent) => {}],
|
|
18
|
+
screenPopped: [(_event: ScreenPoppedEvent) => {}],
|
|
19
|
+
|
|
17
20
|
invokeComponentWillAppear: (event: ComponentWillAppearEvent) => {
|
|
18
21
|
events.componentWillAppear &&
|
|
19
22
|
events.componentWillAppear.forEach((listener) => {
|
|
@@ -56,4 +59,10 @@ export const events = {
|
|
|
56
59
|
listener(event);
|
|
57
60
|
});
|
|
58
61
|
},
|
|
62
|
+
invokeScreenPopped: (event: ScreenPoppedEvent) => {
|
|
63
|
+
events.screenPopped &&
|
|
64
|
+
events.screenPopped.forEach((listener) => {
|
|
65
|
+
listener(event);
|
|
66
|
+
});
|
|
67
|
+
},
|
|
59
68
|
};
|
package/lib/Mock/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ApplicationMock = void 0;
|
|
4
|
-
exports.mockNativeComponents = mockNativeComponents;
|
|
3
|
+
exports.mockNativeComponents = exports.ApplicationMock = void 0;
|
|
5
4
|
const tslib_1 = require("tslib");
|
|
6
5
|
exports.ApplicationMock = require('./Application').Application;
|
|
7
6
|
tslib_1.__exportStar(require("./constants"), exports);
|
|
@@ -12,3 +11,4 @@ function mockNativeComponents() {
|
|
|
12
11
|
const { Navigation } = require('react-native-navigation');
|
|
13
12
|
Navigation.mockNativeComponents(new NativeCommandsSender(), new NativeEventsReceiver(), new AppRegistryService());
|
|
14
13
|
}
|
|
14
|
+
exports.mockNativeComponents = mockNativeComponents;
|
|
@@ -55,6 +55,9 @@ export class NativeCommandsSender {
|
|
|
55
55
|
LayoutStore.getLayoutById(componentId).getStack().children
|
|
56
56
|
) as ComponentNode;
|
|
57
57
|
LayoutStore.pop(componentId);
|
|
58
|
+
events.invokeScreenPopped({
|
|
59
|
+
componentId,
|
|
60
|
+
});
|
|
58
61
|
resolve(poppedChild.nodeId);
|
|
59
62
|
this.reportCommandCompletion(CommandName.Pop, commandId);
|
|
60
63
|
});
|
|
@@ -152,8 +152,9 @@ export class NativeEventsReceiver {
|
|
|
152
152
|
}
|
|
153
153
|
|
|
154
154
|
public registerScreenPoppedListener(
|
|
155
|
-
|
|
155
|
+
callback: (event: ScreenPoppedEvent) => void
|
|
156
156
|
): EmitterSubscription {
|
|
157
|
+
events.screenPopped.push(callback);
|
|
157
158
|
return {
|
|
158
159
|
remove: () => {},
|
|
159
160
|
} as EmitterSubscription;
|
|
@@ -20,6 +20,7 @@ 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
|
+
|
|
23
24
|
android {
|
|
24
25
|
namespace 'com.reactnativenavigation'
|
|
25
26
|
compileSdkVersion safeExtGetFallbackLowerBound('compileSdkVersion', DEFAULT_COMPILE_SDK_VERSION)
|
|
@@ -4,10 +4,12 @@ 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;
|
|
7
8
|
import com.facebook.soloader.SoLoader;
|
|
8
9
|
import com.reactnativenavigation.react.ReactGateway;
|
|
9
10
|
import com.reactnativenavigation.viewcontrollers.externalcomponent.ExternalComponentCreator;
|
|
10
11
|
|
|
12
|
+
import java.io.IOException;
|
|
11
13
|
import java.util.HashMap;
|
|
12
14
|
import java.util.Map;
|
|
13
15
|
|
|
@@ -23,7 +25,11 @@ public abstract class NavigationApplication extends Application implements React
|
|
|
23
25
|
public void onCreate() {
|
|
24
26
|
super.onCreate();
|
|
25
27
|
instance = this;
|
|
26
|
-
|
|
28
|
+
try {
|
|
29
|
+
SoLoader.init(this, OpenSourceMergedSoMapping.INSTANCE);
|
|
30
|
+
} catch (IOException e) {
|
|
31
|
+
throw new RuntimeException(e);
|
|
32
|
+
}
|
|
27
33
|
reactGateway = createReactGateway();
|
|
28
34
|
}
|
|
29
35
|
|
|
@@ -5,6 +5,8 @@ import android.content.Context;
|
|
|
5
5
|
import android.os.Bundle;
|
|
6
6
|
import android.view.MotionEvent;
|
|
7
7
|
|
|
8
|
+
import androidx.annotation.RestrictTo;
|
|
9
|
+
|
|
8
10
|
import com.facebook.react.ReactInstanceManager;
|
|
9
11
|
import com.facebook.react.ReactRootView;
|
|
10
12
|
import com.facebook.react.bridge.ReactContext;
|
|
@@ -12,14 +14,12 @@ import com.facebook.react.config.ReactFeatureFlags;
|
|
|
12
14
|
import com.facebook.react.uimanager.JSTouchDispatcher;
|
|
13
15
|
import com.facebook.react.uimanager.UIManagerModule;
|
|
14
16
|
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
15
|
-
import com.reactnativenavigation.viewcontrollers.viewcontroller.ScrollEventListener;
|
|
16
17
|
import com.reactnativenavigation.react.events.ComponentType;
|
|
17
18
|
import com.reactnativenavigation.react.events.EventEmitter;
|
|
18
19
|
import com.reactnativenavigation.viewcontrollers.viewcontroller.IReactView;
|
|
20
|
+
import com.reactnativenavigation.viewcontrollers.viewcontroller.ScrollEventListener;
|
|
19
21
|
import com.reactnativenavigation.views.component.Renderable;
|
|
20
22
|
|
|
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,6 +18,7 @@ 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;
|
|
21
22
|
import com.facebook.react.views.text.ReactFontManager;
|
|
22
23
|
import com.facebook.react.views.text.ReactTextShadowNode;
|
|
23
24
|
import java.util.ArrayList;
|
|
@@ -96,12 +97,12 @@ public class ReactTypefaceUtils {
|
|
|
96
97
|
|
|
97
98
|
int want = 0;
|
|
98
99
|
if ((weight == Typeface.BOLD)
|
|
99
|
-
|| ((oldStyle & Typeface.BOLD) != 0 && weight ==
|
|
100
|
+
|| ((oldStyle & Typeface.BOLD) != 0 && weight == ReactConstants.UNSET)) {
|
|
100
101
|
want |= Typeface.BOLD;
|
|
101
102
|
}
|
|
102
103
|
|
|
103
104
|
if ((style == Typeface.ITALIC)
|
|
104
|
-
|| ((oldStyle & Typeface.ITALIC) != 0 && style ==
|
|
105
|
+
|| ((oldStyle & Typeface.ITALIC) != 0 && style == ReactConstants.UNSET)) {
|
|
105
106
|
want |= Typeface.ITALIC;
|
|
106
107
|
}
|
|
107
108
|
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
package com.reactnativenavigation.utils
|
|
2
2
|
|
|
3
|
-
import com.facebook.react.
|
|
3
|
+
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
|
4
|
+
import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable
|
|
4
5
|
import com.facebook.react.views.view.ReactViewGroup
|
|
5
6
|
|
|
7
|
+
@OptIn(UnstableReactNativeAPI::class)
|
|
6
8
|
val ReactViewGroup.borderRadius: Float
|
|
7
|
-
get() = (background as?
|
|
9
|
+
get() = (background as? CSSBackgroundDrawable)?.fullBorderWidth ?: 0f
|
|
@@ -5,8 +5,6 @@ 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
|
-
|
|
10
8
|
import java.util.ArrayList;
|
|
11
9
|
import java.util.List;
|
|
12
10
|
|
|
@@ -14,6 +12,9 @@ import androidx.annotation.Nullable;
|
|
|
14
12
|
|
|
15
13
|
import static com.reactnativenavigation.utils.ObjectUtils.perform;
|
|
16
14
|
|
|
15
|
+
import com.facebook.react.common.annotations.UnstableReactNativeAPI;
|
|
16
|
+
import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable;
|
|
17
|
+
|
|
17
18
|
public class ViewUtils {
|
|
18
19
|
@Nullable
|
|
19
20
|
public static <T extends View> T findChildByClass(ViewGroup root, Class<T> clazz) {
|
|
@@ -107,9 +108,10 @@ public class ViewUtils {
|
|
|
107
108
|
return ((ViewGroup) parent).indexOfChild(view);
|
|
108
109
|
}
|
|
109
110
|
|
|
111
|
+
@UnstableReactNativeAPI
|
|
110
112
|
public static int getBackgroundColor(View view) {
|
|
111
|
-
if (view.getBackground() instanceof
|
|
112
|
-
return ((
|
|
113
|
+
if (view.getBackground() instanceof CSSBackgroundDrawable) {
|
|
114
|
+
return ((CSSBackgroundDrawable) view.getBackground()).getColor();
|
|
113
115
|
}
|
|
114
116
|
throw new RuntimeException(view.getBackground().getClass().getSimpleName() + " is not ReactViewBackgroundDrawable");
|
|
115
117
|
}
|
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
package com.reactnativenavigation.viewcontrollers.viewcontroller
|
|
2
2
|
|
|
3
|
+
import android.annotation.SuppressLint
|
|
3
4
|
import com.facebook.react.ReactInstanceManager
|
|
4
5
|
import com.facebook.react.modules.i18nmanager.I18nUtil
|
|
5
6
|
import com.reactnativenavigation.options.Options
|
|
6
7
|
|
|
7
8
|
class LayoutDirectionApplier {
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
@SuppressLint("WrongConstant")
|
|
10
|
+
fun apply(root: ViewController<*>, options: Options) {
|
|
11
|
+
val currentContext = root.view?.context ?: return
|
|
12
|
+
|
|
13
|
+
if (options.layout.direction.hasValue()) {
|
|
10
14
|
root.activity.window.decorView.layoutDirection = options.layout.direction.get()
|
|
11
|
-
I18nUtil.
|
|
12
|
-
I18nUtil.
|
|
15
|
+
I18nUtil.instance.allowRTL(currentContext, options.layout.direction.isRtl)
|
|
16
|
+
I18nUtil.instance.forceRTL(currentContext, options.layout.direction.isRtl)
|
|
13
17
|
}
|
|
14
18
|
}
|
|
15
19
|
}
|
|
@@ -35,7 +35,7 @@ public class RootPresenter {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
public void setRoot(ViewController appearingRoot, ViewController<?> disappearingRoot, Options defaultOptions, CommandListener listener, ReactInstanceManager reactInstanceManager) {
|
|
38
|
-
layoutDirectionApplier.apply(appearingRoot, defaultOptions
|
|
38
|
+
layoutDirectionApplier.apply(appearingRoot, defaultOptions);
|
|
39
39
|
rootLayout.addView(appearingRoot.getView(), matchParentWithBehaviour(new BehaviourDelegate(appearingRoot)));
|
|
40
40
|
Options options = appearingRoot.resolveCurrentOptions(defaultOptions);
|
|
41
41
|
AnimationOptions enter = options.animations.setRoot.getEnter();
|
|
@@ -4,21 +4,23 @@ import android.animation.Animator
|
|
|
4
4
|
import android.animation.ObjectAnimator
|
|
5
5
|
import android.view.View
|
|
6
6
|
import android.view.ViewGroup
|
|
7
|
+
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
|
8
|
+
import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable
|
|
7
9
|
import com.facebook.react.views.text.ReactTextView
|
|
8
|
-
import com.facebook.react.views.view.ReactViewBackgroundDrawable
|
|
9
10
|
import com.reactnativenavigation.options.SharedElementTransitionOptions
|
|
10
11
|
import com.reactnativenavigation.utils.*
|
|
11
12
|
|
|
13
|
+
@OptIn(UnstableReactNativeAPI::class)
|
|
12
14
|
class BackgroundColorAnimator(from: View, to: View) : PropertyAnimatorCreator<ViewGroup>(from, to) {
|
|
13
15
|
override fun shouldAnimateProperty(fromChild: ViewGroup, toChild: ViewGroup): Boolean {
|
|
14
|
-
return fromChild.background is
|
|
15
|
-
toChild.background is
|
|
16
|
+
return fromChild.background is CSSBackgroundDrawable &&
|
|
17
|
+
toChild.background is CSSBackgroundDrawable && (fromChild.background as CSSBackgroundDrawable).color != (toChild.background as CSSBackgroundDrawable).color
|
|
16
18
|
}
|
|
17
19
|
|
|
18
20
|
override fun excludedViews() = listOf(ReactTextView::class.java)
|
|
19
21
|
|
|
20
22
|
override fun create(options: SharedElementTransitionOptions): Animator {
|
|
21
|
-
val backgroundColorEvaluator = BackgroundColorEvaluator(to.background as
|
|
23
|
+
val backgroundColorEvaluator = BackgroundColorEvaluator(to.background as CSSBackgroundDrawable)
|
|
22
24
|
val fromColor = ColorUtils.colorToLAB(ViewUtils.getBackgroundColor(from))
|
|
23
25
|
val toColor = ColorUtils.colorToLAB(ViewUtils.getBackgroundColor(to))
|
|
24
26
|
|
|
@@ -2,11 +2,13 @@ package com.reactnativenavigation.views.element.animators
|
|
|
2
2
|
|
|
3
3
|
import android.animation.TypeEvaluator
|
|
4
4
|
import androidx.core.graphics.ColorUtils
|
|
5
|
-
import com.facebook.react.
|
|
5
|
+
import com.facebook.react.common.annotations.UnstableReactNativeAPI
|
|
6
|
+
import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable
|
|
6
7
|
|
|
7
|
-
class BackgroundColorEvaluator(private val background:
|
|
8
|
+
class BackgroundColorEvaluator @OptIn(UnstableReactNativeAPI::class) constructor(private val background: CSSBackgroundDrawable) : TypeEvaluator<DoubleArray> {
|
|
8
9
|
private val color = DoubleArray(3)
|
|
9
10
|
|
|
11
|
+
@OptIn(UnstableReactNativeAPI::class)
|
|
10
12
|
override fun evaluate(ratio: Float, from: DoubleArray, to: DoubleArray): DoubleArray {
|
|
11
13
|
ColorUtils.blendLAB(from, to, ratio.toDouble(), color)
|
|
12
14
|
background.color = com.reactnativenavigation.utils.ColorUtils.labToColor(color)
|
|
@@ -49,17 +49,17 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{
|
|
|
49
49
|
updateFirstChildView()
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
-
override fun onChildStartedNativeGesture(child: View, androidEvent: MotionEvent
|
|
52
|
+
override fun onChildStartedNativeGesture(child: View, androidEvent: MotionEvent) {
|
|
53
53
|
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher())
|
|
54
54
|
}
|
|
55
|
-
override fun onChildStartedNativeGesture(androidEvent: MotionEvent
|
|
55
|
+
override fun onChildStartedNativeGesture(androidEvent: MotionEvent) {
|
|
56
56
|
mJSTouchDispatcher.onChildStartedNativeGesture(androidEvent, this.getEventDispatcher())
|
|
57
57
|
}
|
|
58
|
-
override fun onChildEndedNativeGesture(child: View, androidEvent: MotionEvent
|
|
58
|
+
override fun onChildEndedNativeGesture(child: View, androidEvent: MotionEvent) {
|
|
59
59
|
mJSTouchDispatcher.onChildEndedNativeGesture(androidEvent, this.getEventDispatcher())
|
|
60
60
|
}
|
|
61
61
|
override fun requestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {}
|
|
62
|
-
private fun getEventDispatcher(): EventDispatcher
|
|
62
|
+
private fun getEventDispatcher(): EventDispatcher {
|
|
63
63
|
val reactContext: ReactContext = this.getReactContext()
|
|
64
64
|
return reactContext.getNativeModule(UIManagerModule::class.java)!!.eventDispatcher
|
|
65
65
|
}
|
|
@@ -73,12 +73,12 @@ class ModalContentLayout(context: Context?) : ReactViewGroup(context), RootView{
|
|
|
73
73
|
return this.context as ReactContext
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
-
override fun onInterceptTouchEvent(event: MotionEvent
|
|
76
|
+
override fun onInterceptTouchEvent(event: MotionEvent): Boolean {
|
|
77
77
|
mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher())
|
|
78
78
|
return super.onInterceptTouchEvent(event)
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
override fun onTouchEvent(event: MotionEvent
|
|
81
|
+
override fun onTouchEvent(event: MotionEvent): Boolean {
|
|
82
82
|
mJSTouchDispatcher.handleTouchEvent(event, getEventDispatcher())
|
|
83
83
|
super.onTouchEvent(event)
|
|
84
84
|
return true
|
|
@@ -4,13 +4,11 @@ interface ApplicationProps {
|
|
|
4
4
|
}
|
|
5
5
|
export declare const Application: {
|
|
6
6
|
new (props: ApplicationProps): {
|
|
7
|
-
render(): JSX.Element;
|
|
8
|
-
context:
|
|
7
|
+
render(): React.JSX.Element;
|
|
8
|
+
context: unknown;
|
|
9
9
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ApplicationProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
10
10
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
11
|
-
readonly props: Readonly<ApplicationProps
|
|
12
|
-
children?: React.ReactNode;
|
|
13
|
-
}>;
|
|
11
|
+
readonly props: Readonly<ApplicationProps>;
|
|
14
12
|
state: Readonly<{}>;
|
|
15
13
|
refs: {
|
|
16
14
|
[key: string]: React.ReactInstance;
|
|
@@ -28,6 +26,6 @@ export declare const Application: {
|
|
|
28
26
|
componentWillUpdate?(nextProps: Readonly<ApplicationProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
29
27
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<ApplicationProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
30
28
|
};
|
|
31
|
-
contextType?: React.Context<any
|
|
29
|
+
contextType?: React.Context<any> | undefined;
|
|
32
30
|
};
|
|
33
31
|
export {};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentProps } from '../ComponentProps';
|
|
3
3
|
export declare const BottomTabs: {
|
|
4
|
-
new (props:
|
|
5
|
-
render(): JSX.Element[];
|
|
6
|
-
context:
|
|
4
|
+
new (props: ComponentProps): {
|
|
5
|
+
render(): React.JSX.Element[];
|
|
6
|
+
context: unknown;
|
|
7
7
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ComponentProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
8
8
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
9
|
-
readonly props: Readonly<ComponentProps
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
}>;
|
|
9
|
+
readonly props: Readonly<ComponentProps>;
|
|
12
10
|
state: Readonly<{}>;
|
|
13
11
|
refs: {
|
|
14
12
|
[key: string]: React.ReactInstance;
|
|
@@ -26,14 +24,12 @@ export declare const BottomTabs: {
|
|
|
26
24
|
componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
27
25
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
28
26
|
};
|
|
29
|
-
new (props: ComponentProps, context
|
|
30
|
-
render(): JSX.Element[];
|
|
31
|
-
context:
|
|
27
|
+
new (props: ComponentProps, context: any): {
|
|
28
|
+
render(): React.JSX.Element[];
|
|
29
|
+
context: unknown;
|
|
32
30
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ComponentProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
33
31
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
34
|
-
readonly props: Readonly<ComponentProps
|
|
35
|
-
children?: React.ReactNode;
|
|
36
|
-
}>;
|
|
32
|
+
readonly props: Readonly<ComponentProps>;
|
|
37
33
|
state: Readonly<{}>;
|
|
38
34
|
refs: {
|
|
39
35
|
[key: string]: React.ReactInstance;
|
|
@@ -51,5 +47,5 @@ export declare const BottomTabs: {
|
|
|
51
47
|
componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
52
48
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
53
49
|
};
|
|
54
|
-
contextType?: React.Context<any
|
|
50
|
+
contextType?: React.Context<any> | undefined;
|
|
55
51
|
};
|
|
@@ -4,14 +4,12 @@ export declare const ComponentScreen: {
|
|
|
4
4
|
new (props: ComponentProps): {
|
|
5
5
|
componentDidMount(): void;
|
|
6
6
|
isVisible(): boolean;
|
|
7
|
-
renderTabBar(): JSX.Element | null;
|
|
8
|
-
render(): JSX.Element;
|
|
9
|
-
context:
|
|
7
|
+
renderTabBar(): React.JSX.Element | null;
|
|
8
|
+
render(): React.JSX.Element;
|
|
9
|
+
context: unknown;
|
|
10
10
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ComponentProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
11
11
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
12
|
-
readonly props: Readonly<ComponentProps
|
|
13
|
-
children?: React.ReactNode;
|
|
14
|
-
}>;
|
|
12
|
+
readonly props: Readonly<ComponentProps>;
|
|
15
13
|
state: Readonly<{}>;
|
|
16
14
|
refs: {
|
|
17
15
|
[key: string]: React.ReactInstance;
|
|
@@ -28,5 +26,5 @@ export declare const ComponentScreen: {
|
|
|
28
26
|
componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
29
27
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
30
28
|
};
|
|
31
|
-
contextType?: React.Context<any
|
|
29
|
+
contextType?: React.Context<any> | undefined;
|
|
32
30
|
};
|
|
@@ -34,7 +34,9 @@ exports.ComponentScreen = (0, connect_1.connect)(class extends react_1.Component
|
|
|
34
34
|
return null;
|
|
35
35
|
const buttons = bottomTabs.children.map((child, i) => {
|
|
36
36
|
const bottomTabOptions = child.resolveOptions().bottomTab;
|
|
37
|
-
const icon = bottomTabs.selectedIndex === i
|
|
37
|
+
const icon = bottomTabs.selectedIndex === i
|
|
38
|
+
? bottomTabOptions?.selectedIcon
|
|
39
|
+
: bottomTabOptions?.icon;
|
|
38
40
|
const iconURI = isURISource(icon) ? icon.uri : undefined;
|
|
39
41
|
return (react_1.default.createElement(react_native_1.View, { key: `tab-${i}` },
|
|
40
42
|
react_1.default.createElement(react_native_1.TouchableOpacity, { style: { padding: 10 }, testID: bottomTabOptions?.testID, onPress: () => {
|
|
@@ -46,10 +48,15 @@ exports.ComponentScreen = (0, connect_1.connect)(class extends react_1.Component
|
|
|
46
48
|
} },
|
|
47
49
|
react_1.default.createElement(react_native_1.View, { style: { justifyContent: 'center', alignItems: 'center' } },
|
|
48
50
|
react_1.default.createElement(react_native_1.Text, null, bottomTabOptions?.badge),
|
|
49
|
-
iconURI && react_1.default.createElement(react_native_1.Image, { style: { width: 18, height: 18, marginBottom: 5 }, source: { uri: iconURI } }),
|
|
51
|
+
iconURI && (react_1.default.createElement(react_native_1.Image, { style: { width: 18, height: 18, marginBottom: 5 }, source: { uri: iconURI } })),
|
|
50
52
|
react_1.default.createElement(react_native_1.Text, { style: { fontSize: 12 } }, bottomTabOptions?.text || '')))));
|
|
51
53
|
});
|
|
52
|
-
return (react_1.default.createElement(react_native_1.View, { testID: bottomTabsOptions?.testID, style: {
|
|
54
|
+
return (react_1.default.createElement(react_native_1.View, { testID: bottomTabsOptions?.testID, style: {
|
|
55
|
+
flexDirection: 'row',
|
|
56
|
+
justifyContent: 'center',
|
|
57
|
+
width: '100%',
|
|
58
|
+
backgroundColor: '#F0F2F5',
|
|
59
|
+
} }, buttons));
|
|
53
60
|
}
|
|
54
61
|
render() {
|
|
55
62
|
const Component = react_native_navigation_1.Navigation.mock.store.getWrappedComponent(this.props.layoutNode.data.name);
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentProps } from '../ComponentProps';
|
|
3
3
|
export declare const LayoutComponent: {
|
|
4
|
-
new (props:
|
|
5
|
-
render(): JSX.Element;
|
|
4
|
+
new (props: ComponentProps): {
|
|
5
|
+
render(): React.JSX.Element;
|
|
6
6
|
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
7
|
-
context:
|
|
7
|
+
context: unknown;
|
|
8
8
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ComponentProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
9
9
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
10
|
-
readonly props: Readonly<ComponentProps
|
|
11
|
-
children?: React.ReactNode;
|
|
12
|
-
}>;
|
|
10
|
+
readonly props: Readonly<ComponentProps>;
|
|
13
11
|
state: Readonly<{}>;
|
|
14
12
|
refs: {
|
|
15
13
|
[key: string]: React.ReactInstance;
|
|
@@ -26,15 +24,13 @@ export declare const LayoutComponent: {
|
|
|
26
24
|
componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
27
25
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
28
26
|
};
|
|
29
|
-
new (props: ComponentProps, context
|
|
30
|
-
render(): JSX.Element;
|
|
27
|
+
new (props: ComponentProps, context: any): {
|
|
28
|
+
render(): React.JSX.Element;
|
|
31
29
|
componentDidCatch(error: Error, errorInfo: React.ErrorInfo): void;
|
|
32
|
-
context:
|
|
30
|
+
context: unknown;
|
|
33
31
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ComponentProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
34
32
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
35
|
-
readonly props: Readonly<ComponentProps
|
|
36
|
-
children?: React.ReactNode;
|
|
37
|
-
}>;
|
|
33
|
+
readonly props: Readonly<ComponentProps>;
|
|
38
34
|
state: Readonly<{}>;
|
|
39
35
|
refs: {
|
|
40
36
|
[key: string]: React.ReactInstance;
|
|
@@ -51,5 +47,5 @@ export declare const LayoutComponent: {
|
|
|
51
47
|
componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
52
48
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
53
49
|
};
|
|
54
|
-
contextType?: React.Context<any
|
|
50
|
+
contextType?: React.Context<any> | undefined;
|
|
55
51
|
};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { ComponentProps } from '../ComponentProps';
|
|
3
3
|
export declare const Modals: {
|
|
4
|
-
new (props:
|
|
5
|
-
render(): JSX.Element;
|
|
6
|
-
context:
|
|
4
|
+
new (props: ComponentProps): {
|
|
5
|
+
render(): React.JSX.Element;
|
|
6
|
+
context: unknown;
|
|
7
7
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ComponentProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
8
8
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
9
|
-
readonly props: Readonly<ComponentProps
|
|
10
|
-
children?: React.ReactNode;
|
|
11
|
-
}>;
|
|
9
|
+
readonly props: Readonly<ComponentProps>;
|
|
12
10
|
state: Readonly<{}>;
|
|
13
11
|
refs: {
|
|
14
12
|
[key: string]: React.ReactInstance;
|
|
@@ -26,14 +24,12 @@ export declare const Modals: {
|
|
|
26
24
|
componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
27
25
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
28
26
|
};
|
|
29
|
-
new (props: ComponentProps, context
|
|
30
|
-
render(): JSX.Element;
|
|
31
|
-
context:
|
|
27
|
+
new (props: ComponentProps, context: any): {
|
|
28
|
+
render(): React.JSX.Element;
|
|
29
|
+
context: unknown;
|
|
32
30
|
setState<K extends never>(state: {} | ((prevState: Readonly<{}>, props: Readonly<ComponentProps>) => {} | Pick<{}, K> | null) | Pick<{}, K> | null, callback?: (() => void) | undefined): void;
|
|
33
31
|
forceUpdate(callback?: (() => void) | undefined): void;
|
|
34
|
-
readonly props: Readonly<ComponentProps
|
|
35
|
-
children?: React.ReactNode;
|
|
36
|
-
}>;
|
|
32
|
+
readonly props: Readonly<ComponentProps>;
|
|
37
33
|
state: Readonly<{}>;
|
|
38
34
|
refs: {
|
|
39
35
|
[key: string]: React.ReactInstance;
|
|
@@ -51,5 +47,5 @@ export declare const Modals: {
|
|
|
51
47
|
componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
52
48
|
UNSAFE_componentWillUpdate?(nextProps: Readonly<ComponentProps>, nextState: Readonly<{}>, nextContext: any): void;
|
|
53
49
|
};
|
|
54
|
-
contextType?: React.Context<any
|
|
50
|
+
contextType?: React.Context<any> | undefined;
|
|
55
51
|
};
|