@amazon-devices/react-navigation__stack 8.0.9000000000 → 8.0.9000000002
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/SystemModules/amzn__react-navigation__stack-8.private.modules.txt +39 -34
- package/kepler-compatibility.json +4 -2
- package/lib/module/index.js +0 -34
- package/lib/typescript/src/index.d.ts +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/oss-attribution/attribution.txt +76 -0
- package/oss-attribution/licenseInfos.json +27 -0
- package/package.json +1 -1
- package/src/index.tsx +0 -55
- package/SystemBundles/98ca5eeb45684e3e5615c766e1d3a956fee53d14cd6c2318098c23c210bd76d7.bundle +0 -13464
- package/SystemBundles/98ca5eeb45684e3e5615c766e1d3a956fee53d14cd6c2318098c23c210bd76d7.map +0 -4638
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js +0 -394
- package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js +0 -262
- package/lib/module/TransitionConfigs/TransitionPresets.js +0 -156
- package/lib/module/TransitionConfigs/TransitionSpecs.js +0 -124
- package/lib/module/navigators/createStackNavigator.js +0 -71
- package/lib/module/types.js +0 -4
- package/lib/module/utils/CardAnimationContext.js +0 -5
- package/lib/module/utils/GestureHandlerRefContext.js +0 -5
- package/lib/module/utils/ModalPresentationContext.js +0 -5
- package/lib/module/utils/conditional.js +0 -28
- package/lib/module/utils/findLastIndex.js +0 -11
- package/lib/module/utils/gestureActivationCriteria.js +0 -60
- package/lib/module/utils/getDistanceForDirection.js +0 -15
- package/lib/module/utils/getInvertedMultiplier.js +0 -15
- package/lib/module/utils/getModalRoutesKeys.js +0 -12
- package/lib/module/utils/getShadowStyle.js +0 -24
- package/lib/module/utils/throttle.js +0 -14
- package/lib/module/utils/useCardAnimation.js +0 -12
- package/lib/module/utils/useGestureHandlerRef.js +0 -12
- package/lib/module/utils/useKeyboardManager.js +0 -90
- package/lib/module/views/GestureHandler.android.js +0 -4
- package/lib/module/views/GestureHandler.ios.js +0 -4
- package/lib/module/views/GestureHandler.js +0 -21
- package/lib/module/views/GestureHandler.kepler.js +0 -4
- package/lib/module/views/GestureHandlerNative.js +0 -18
- package/lib/module/views/Header/Header.js +0 -56
- package/lib/module/views/Header/HeaderContainer.js +0 -128
- package/lib/module/views/Header/HeaderSegment.js +0 -142
- package/lib/module/views/Screens.js +0 -42
- package/lib/module/views/Stack/Card.js +0 -433
- package/lib/module/views/Stack/CardA11yWrapper.js +0 -43
- package/lib/module/views/Stack/CardContainer.js +0 -276
- package/lib/module/views/Stack/CardContent.js +0 -74
- package/lib/module/views/Stack/CardStack.js +0 -493
- package/lib/module/views/Stack/StackView.js +0 -339
- package/src/TransitionConfigs/CardStyleInterpolators.tsx +0 -460
- package/src/TransitionConfigs/HeaderStyleInterpolators.tsx +0 -286
- package/src/TransitionConfigs/TransitionPresets.tsx +0 -182
- package/src/TransitionConfigs/TransitionSpecs.tsx +0 -124
- package/src/navigators/createStackNavigator.tsx +0 -120
- package/src/types.tsx +0 -639
- package/src/utils/CardAnimationContext.tsx +0 -7
- package/src/utils/GestureHandlerRefContext.tsx +0 -5
- package/src/utils/ModalPresentationContext.tsx +0 -3
- package/src/utils/conditional.tsx +0 -33
- package/src/utils/findLastIndex.tsx +0 -9
- package/src/utils/gestureActivationCriteria.tsx +0 -70
- package/src/utils/getDistanceForDirection.tsx +0 -19
- package/src/utils/getInvertedMultiplier.tsx +0 -17
- package/src/utils/getModalRoutesKeys.ts +0 -21
- package/src/utils/getShadowStyle.tsx +0 -37
- package/src/utils/throttle.tsx +0 -16
- package/src/utils/useCardAnimation.tsx +0 -15
- package/src/utils/useGestureHandlerRef.tsx +0 -15
- package/src/utils/useKeyboardManager.tsx +0 -103
- package/src/views/GestureHandler.android.tsx +0 -1
- package/src/views/GestureHandler.ios.tsx +0 -1
- package/src/views/GestureHandler.kepler.tsx +0 -1
- package/src/views/GestureHandler.tsx +0 -23
- package/src/views/GestureHandlerNative.tsx +0 -23
- package/src/views/Header/Header.tsx +0 -73
- package/src/views/Header/HeaderContainer.tsx +0 -191
- package/src/views/Header/HeaderSegment.tsx +0 -203
- package/src/views/Screens.tsx +0 -45
- package/src/views/Stack/Card.tsx +0 -646
- package/src/views/Stack/CardA11yWrapper.tsx +0 -67
- package/src/views/Stack/CardContainer.tsx +0 -339
- package/src/views/Stack/CardContent.tsx +0 -92
- package/src/views/Stack/CardStack.tsx +0 -844
- package/src/views/Stack/StackView.tsx +0 -485
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { Platform } from 'react-native';
|
|
4
|
-
import { forBottomSheetAndroid, forFadeFromBottomAndroid, forFadeFromCenter as forFadeCard, forFadeFromRightAndroid, forHorizontalIOS, forHorizontalIOSInverted, forModalPresentationIOS, forRevealFromBottomAndroid, forScaleFromCenterAndroid, forVerticalIOS } from "./CardStyleInterpolators.js";
|
|
5
|
-
import { forFade } from "./HeaderStyleInterpolators.js";
|
|
6
|
-
import { BottomSheetSlideInSpec, BottomSheetSlideOutSpec, FadeInFromBottomAndroidSpec, FadeOutToBottomAndroidSpec, RevealFromBottomAndroidSpec, ScaleFromCenterAndroidSpec, TransitionIOSSpec } from "./TransitionSpecs.js";
|
|
7
|
-
const ANDROID_VERSION_PIE = 28;
|
|
8
|
-
const ANDROID_VERSION_10 = 29;
|
|
9
|
-
const ANDROID_VERSION_14 = 34;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Standard iOS navigation transition.
|
|
13
|
-
*/
|
|
14
|
-
export const SlideFromRightIOS = {
|
|
15
|
-
gestureDirection: 'horizontal',
|
|
16
|
-
transitionSpec: {
|
|
17
|
-
open: TransitionIOSSpec,
|
|
18
|
-
close: TransitionIOSSpec
|
|
19
|
-
},
|
|
20
|
-
cardStyleInterpolator: forHorizontalIOS,
|
|
21
|
-
headerStyleInterpolator: forFade
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Standard iOS navigation transition for modals.
|
|
26
|
-
*/
|
|
27
|
-
export const ModalSlideFromBottomIOS = {
|
|
28
|
-
gestureDirection: 'vertical',
|
|
29
|
-
transitionSpec: {
|
|
30
|
-
open: TransitionIOSSpec,
|
|
31
|
-
close: TransitionIOSSpec
|
|
32
|
-
},
|
|
33
|
-
cardStyleInterpolator: forVerticalIOS,
|
|
34
|
-
headerStyleInterpolator: forFade
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* Standard iOS modal presentation style (introduced in iOS 13).
|
|
39
|
-
*/
|
|
40
|
-
export const ModalPresentationIOS = {
|
|
41
|
-
gestureDirection: 'vertical',
|
|
42
|
-
transitionSpec: {
|
|
43
|
-
open: TransitionIOSSpec,
|
|
44
|
-
close: TransitionIOSSpec
|
|
45
|
-
},
|
|
46
|
-
cardStyleInterpolator: forModalPresentationIOS,
|
|
47
|
-
headerStyleInterpolator: forFade
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* Standard Android navigation transition when opening or closing an Activity on Android < 9 (Oreo).
|
|
52
|
-
*/
|
|
53
|
-
export const FadeFromBottomAndroid = {
|
|
54
|
-
gestureDirection: 'vertical',
|
|
55
|
-
transitionSpec: {
|
|
56
|
-
open: FadeInFromBottomAndroidSpec,
|
|
57
|
-
close: FadeOutToBottomAndroidSpec
|
|
58
|
-
},
|
|
59
|
-
cardStyleInterpolator: forFadeFromBottomAndroid,
|
|
60
|
-
headerStyleInterpolator: forFade
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* Standard Android navigation transition when opening or closing an Activity on Android 9 (Pie).
|
|
65
|
-
*/
|
|
66
|
-
export const RevealFromBottomAndroid = {
|
|
67
|
-
gestureDirection: 'vertical',
|
|
68
|
-
transitionSpec: {
|
|
69
|
-
open: RevealFromBottomAndroidSpec,
|
|
70
|
-
close: RevealFromBottomAndroidSpec
|
|
71
|
-
},
|
|
72
|
-
cardStyleInterpolator: forRevealFromBottomAndroid,
|
|
73
|
-
headerStyleInterpolator: forFade
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
* Standard Android navigation transition when opening or closing an Activity on Android 10 (Q).
|
|
78
|
-
*/
|
|
79
|
-
export const ScaleFromCenterAndroid = {
|
|
80
|
-
gestureDirection: 'horizontal',
|
|
81
|
-
transitionSpec: {
|
|
82
|
-
open: ScaleFromCenterAndroidSpec,
|
|
83
|
-
close: ScaleFromCenterAndroidSpec
|
|
84
|
-
},
|
|
85
|
-
cardStyleInterpolator: forScaleFromCenterAndroid,
|
|
86
|
-
headerStyleInterpolator: forFade
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Standard Android navigation transition when opening or closing an Activity on Android 14.
|
|
91
|
-
*/
|
|
92
|
-
export const FadeFromRightAndroid = {
|
|
93
|
-
gestureDirection: 'horizontal',
|
|
94
|
-
transitionSpec: {
|
|
95
|
-
open: FadeInFromBottomAndroidSpec,
|
|
96
|
-
close: FadeOutToBottomAndroidSpec
|
|
97
|
-
},
|
|
98
|
-
cardStyleInterpolator: forFadeFromRightAndroid,
|
|
99
|
-
headerStyleInterpolator: forFade
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* Standard bottom sheet slide transition for Android 10.
|
|
104
|
-
*/
|
|
105
|
-
export const BottomSheetAndroid = {
|
|
106
|
-
gestureDirection: 'vertical',
|
|
107
|
-
transitionSpec: {
|
|
108
|
-
open: BottomSheetSlideInSpec,
|
|
109
|
-
close: BottomSheetSlideOutSpec
|
|
110
|
-
},
|
|
111
|
-
cardStyleInterpolator: forBottomSheetAndroid,
|
|
112
|
-
headerStyleInterpolator: forFade
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
/**
|
|
116
|
-
* Fade transition for transparent modals.
|
|
117
|
-
*/
|
|
118
|
-
export const ModalFadeTransition = {
|
|
119
|
-
gestureDirection: 'vertical',
|
|
120
|
-
transitionSpec: {
|
|
121
|
-
open: BottomSheetSlideInSpec,
|
|
122
|
-
close: BottomSheetSlideOutSpec
|
|
123
|
-
},
|
|
124
|
-
cardStyleInterpolator: forFadeCard,
|
|
125
|
-
headerStyleInterpolator: forFade
|
|
126
|
-
};
|
|
127
|
-
|
|
128
|
-
/**
|
|
129
|
-
* Default navigation transition for the current platform.
|
|
130
|
-
*/
|
|
131
|
-
export const DefaultTransition = Platform.select({
|
|
132
|
-
// @ts-ignore - add default value for kepler (leaving for easy override)
|
|
133
|
-
kepler: ScaleFromCenterAndroid,
|
|
134
|
-
ios: SlideFromRightIOS,
|
|
135
|
-
android: Number(Platform.Version) >= ANDROID_VERSION_14 ? FadeFromRightAndroid : Number(Platform.Version) >= ANDROID_VERSION_10 ? ScaleFromCenterAndroid : Number(Platform.Version) >= ANDROID_VERSION_PIE ? RevealFromBottomAndroid : FadeFromBottomAndroid,
|
|
136
|
-
default: ScaleFromCenterAndroid
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* Default modal transition for the current platform.
|
|
141
|
-
*/
|
|
142
|
-
export const ModalTransition = Platform.select({
|
|
143
|
-
// @ts-ignore - add default value for kepler (leaving for easy override)
|
|
144
|
-
kepler: BottomSheetAndroid,
|
|
145
|
-
ios: ModalPresentationIOS,
|
|
146
|
-
default: BottomSheetAndroid
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
/**
|
|
150
|
-
* Slide from left transition.
|
|
151
|
-
*/
|
|
152
|
-
export const SlideFromLeftIOS = {
|
|
153
|
-
...SlideFromRightIOS,
|
|
154
|
-
cardStyleInterpolator: forHorizontalIOSInverted
|
|
155
|
-
};
|
|
156
|
-
//# sourceMappingURL=TransitionPresets.js.map
|
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { Easing } from 'react-native';
|
|
4
|
-
/**
|
|
5
|
-
* Exact values from UINavigationController's animation configuration.
|
|
6
|
-
*/
|
|
7
|
-
export const TransitionIOSSpec = {
|
|
8
|
-
animation: 'spring',
|
|
9
|
-
config: {
|
|
10
|
-
stiffness: 1000,
|
|
11
|
-
damping: 500,
|
|
12
|
-
mass: 3,
|
|
13
|
-
overshootClamping: true,
|
|
14
|
-
restDisplacementThreshold: 10,
|
|
15
|
-
restSpeedThreshold: 10
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Configuration for activity open animation from Android Nougat.
|
|
21
|
-
* See http://aosp.opersys.com/xref/android-7.1.2_r37/xref/frameworks/base/core/res/res/anim/activity_open_enter.xml
|
|
22
|
-
*/
|
|
23
|
-
export const FadeInFromBottomAndroidSpec = {
|
|
24
|
-
animation: 'timing',
|
|
25
|
-
config: {
|
|
26
|
-
duration: 350,
|
|
27
|
-
easing: Easing.out(Easing.poly(5))
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Configuration for activity close animation from Android Nougat.
|
|
33
|
-
* See http://aosp.opersys.com/xref/android-7.1.2_r37/xref/frameworks/base/core/res/res/anim/activity_close_exit.xml
|
|
34
|
-
*/
|
|
35
|
-
export const FadeOutToBottomAndroidSpec = {
|
|
36
|
-
animation: 'timing',
|
|
37
|
-
config: {
|
|
38
|
-
duration: 150,
|
|
39
|
-
easing: Easing.in(Easing.linear)
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Approximate configuration for activity open animation from Android Pie.
|
|
45
|
-
* See http://aosp.opersys.com/xref/android-9.0.0_r47/xref/frameworks/base/core/res/res/anim/activity_open_enter.xml
|
|
46
|
-
*/
|
|
47
|
-
export const RevealFromBottomAndroidSpec = {
|
|
48
|
-
animation: 'timing',
|
|
49
|
-
config: {
|
|
50
|
-
duration: 425,
|
|
51
|
-
// This is super rough approximation of the path used for the curve by android
|
|
52
|
-
// See http://aosp.opersys.com/xref/android-9.0.0_r47/xref/frameworks/base/core/res/res/interpolator/fast_out_extra_slow_in.xml
|
|
53
|
-
easing: Easing.bezier(0.20833, 0.82, 0.25, 1)
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
/**
|
|
58
|
-
* Approximate configuration for activity open animation from Android Q.
|
|
59
|
-
* See http://aosp.opersys.com/xref/android-10.0.0_r2/xref/frameworks/base/core/res/res/anim/activity_open_enter.xml
|
|
60
|
-
*/
|
|
61
|
-
export const ScaleFromCenterAndroidSpec = {
|
|
62
|
-
animation: 'timing',
|
|
63
|
-
config: {
|
|
64
|
-
duration: 400,
|
|
65
|
-
// This is super rough approximation of the path used for the curve by android
|
|
66
|
-
// See http://aosp.opersys.com/xref/android-10.0.0_r2/xref/frameworks/base/core/res/res/interpolator/fast_out_extra_slow_in.xml
|
|
67
|
-
easing: Easing.bezier(0.20833, 0.82, 0.25, 1)
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Approximate configuration for activity open animation from Android 14.
|
|
73
|
-
* See https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r51/core/res/res/anim/activity_open_enter.xml
|
|
74
|
-
*/
|
|
75
|
-
export const FadeInFromRightAndroidSpec = {
|
|
76
|
-
animation: 'timing',
|
|
77
|
-
config: {
|
|
78
|
-
duration: 450,
|
|
79
|
-
// This is super rough approximation of the path used for the curve by android
|
|
80
|
-
// See https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r51/core/res/res/interpolator/fast_out_extra_slow_in.xml
|
|
81
|
-
easing: Easing.bezier(0.20833, 0.82, 0.25, 1)
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Approximate configuration for activity close animation from Android 14.
|
|
87
|
-
* See https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r51/core/res/res/anim/activity_close_exit.xml
|
|
88
|
-
*/
|
|
89
|
-
export const FadeOutToLeftAndroidSpec = {
|
|
90
|
-
animation: 'timing',
|
|
91
|
-
config: {
|
|
92
|
-
duration: 450,
|
|
93
|
-
// This is super rough approximation of the path used for the curve by android
|
|
94
|
-
// See https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r51/core/res/res/interpolator/fast_out_extra_slow_in.xml
|
|
95
|
-
easing: Easing.bezier(0.20833, 0.82, 0.25, 1)
|
|
96
|
-
}
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Configuration for bottom sheet slide in animation from Material Design.
|
|
101
|
-
* See https://github.com/material-components/material-components-android/blob/fd3639092e1ffef9dc11bcedf79f32801d85e898/lib/java/com/google/android/material/bottomsheet/res/anim/mtrl_bottom_sheet_slide_in.xml
|
|
102
|
-
*/
|
|
103
|
-
export const BottomSheetSlideInSpec = {
|
|
104
|
-
animation: 'timing',
|
|
105
|
-
config: {
|
|
106
|
-
duration: 250,
|
|
107
|
-
// See https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/animation/AccelerateDecelerateInterpolator.java
|
|
108
|
-
easing: t => Math.cos((t + 1) * Math.PI) / 2.0 + 0.5
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
/**
|
|
113
|
-
* Configuration for bottom sheet slide out animation from Material Design.
|
|
114
|
-
* See https://github.com/material-components/material-components-android/blob/fd3639092e1ffef9dc11bcedf79f32801d85e898/lib/java/com/google/android/material/bottomsheet/res/anim/mtrl_bottom_sheet_slide_in.xml
|
|
115
|
-
*/
|
|
116
|
-
export const BottomSheetSlideOutSpec = {
|
|
117
|
-
animation: 'timing',
|
|
118
|
-
config: {
|
|
119
|
-
duration: 200,
|
|
120
|
-
// See https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/view/animation/AccelerateInterpolator.java
|
|
121
|
-
easing: t => t === 1.0 ? 1 : Math.pow(t, 2)
|
|
122
|
-
}
|
|
123
|
-
};
|
|
124
|
-
//# sourceMappingURL=TransitionSpecs.js.map
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { createNavigatorFactory, StackActions, StackRouter, useLocale, useNavigationBuilder } from '@amazon-devices/react-navigation__native';
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import { StackView } from "../views/Stack/StackView.js";
|
|
6
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
-
function StackNavigator({
|
|
8
|
-
id,
|
|
9
|
-
initialRouteName,
|
|
10
|
-
UNSTABLE_routeNamesChangeBehavior,
|
|
11
|
-
children,
|
|
12
|
-
layout,
|
|
13
|
-
screenListeners,
|
|
14
|
-
screenOptions,
|
|
15
|
-
screenLayout,
|
|
16
|
-
UNSTABLE_router,
|
|
17
|
-
...rest
|
|
18
|
-
}) {
|
|
19
|
-
const {
|
|
20
|
-
direction
|
|
21
|
-
} = useLocale();
|
|
22
|
-
const {
|
|
23
|
-
state,
|
|
24
|
-
describe,
|
|
25
|
-
descriptors,
|
|
26
|
-
navigation,
|
|
27
|
-
NavigationContent
|
|
28
|
-
} = useNavigationBuilder(StackRouter, {
|
|
29
|
-
id,
|
|
30
|
-
initialRouteName,
|
|
31
|
-
UNSTABLE_routeNamesChangeBehavior,
|
|
32
|
-
children,
|
|
33
|
-
layout,
|
|
34
|
-
screenListeners,
|
|
35
|
-
screenOptions,
|
|
36
|
-
screenLayout,
|
|
37
|
-
UNSTABLE_router
|
|
38
|
-
});
|
|
39
|
-
React.useEffect(() =>
|
|
40
|
-
// @ts-expect-error: there may not be a tab navigator in parent
|
|
41
|
-
navigation.addListener?.('tabPress', e => {
|
|
42
|
-
const isFocused = navigation.isFocused();
|
|
43
|
-
|
|
44
|
-
// Run the operation in the next frame so we're sure all listeners have been run
|
|
45
|
-
// This is necessary to know if preventDefault() has been called
|
|
46
|
-
requestAnimationFrame(() => {
|
|
47
|
-
if (state.index > 0 && isFocused && !e.defaultPrevented) {
|
|
48
|
-
// When user taps on already focused tab and we're inside the tab,
|
|
49
|
-
// reset the stack to replicate native behaviour
|
|
50
|
-
navigation.dispatch({
|
|
51
|
-
...StackActions.popToTop(),
|
|
52
|
-
target: state.key
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
}), [navigation, state.index, state.key]);
|
|
57
|
-
return /*#__PURE__*/_jsx(NavigationContent, {
|
|
58
|
-
children: /*#__PURE__*/_jsx(StackView, {
|
|
59
|
-
...rest,
|
|
60
|
-
direction: direction,
|
|
61
|
-
state: state,
|
|
62
|
-
describe: describe,
|
|
63
|
-
descriptors: descriptors,
|
|
64
|
-
navigation: navigation
|
|
65
|
-
})
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
export function createStackNavigator(config) {
|
|
69
|
-
return createNavigatorFactory(StackNavigator)(config);
|
|
70
|
-
}
|
|
71
|
-
//# sourceMappingURL=createStackNavigator.js.map
|
package/lib/module/types.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { Animated } from 'react-native';
|
|
4
|
-
const {
|
|
5
|
-
add,
|
|
6
|
-
multiply
|
|
7
|
-
} = Animated;
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* Use an Animated Node based on a condition. Similar to Reanimated's `cond`.
|
|
11
|
-
*
|
|
12
|
-
* @param condition Animated Node representing the condition, must be 0 or 1, 1 means `true`, 0 means `false`
|
|
13
|
-
* @param main Animated Node to use if the condition is `true`
|
|
14
|
-
* @param fallback Animated Node to use if the condition is `false`
|
|
15
|
-
*/
|
|
16
|
-
export function conditional(condition, main, fallback) {
|
|
17
|
-
// To implement this behavior, we multiply the main node with the condition.
|
|
18
|
-
// So if condition is 0, result will be 0, and if condition is 1, result will be main node.
|
|
19
|
-
// Then we multiple reverse of the condition (0 if condition is 1) with the fallback.
|
|
20
|
-
// So if condition is 0, result will be fallback node, and if condition is 1, result will be 0,
|
|
21
|
-
// This way, one of them will always be 0, and other one will be the value we need.
|
|
22
|
-
// In the end we add them both together, 0 + value we need = value we need
|
|
23
|
-
return add(multiply(condition, main), multiply(condition.interpolate({
|
|
24
|
-
inputRange: [0, 1],
|
|
25
|
-
outputRange: [1, 0]
|
|
26
|
-
}), fallback));
|
|
27
|
-
}
|
|
28
|
-
//# sourceMappingURL=conditional.js.map
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { getInvertedMultiplier } from "./getInvertedMultiplier.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* The distance of touch start from the edge of the screen where the gesture will be recognized
|
|
7
|
-
*/
|
|
8
|
-
const GESTURE_RESPONSE_DISTANCE_HORIZONTAL = 50;
|
|
9
|
-
const GESTURE_RESPONSE_DISTANCE_VERTICAL = 135;
|
|
10
|
-
export const gestureActivationCriteria = ({
|
|
11
|
-
direction,
|
|
12
|
-
gestureDirection,
|
|
13
|
-
gestureResponseDistance,
|
|
14
|
-
layout
|
|
15
|
-
}) => {
|
|
16
|
-
const enableTrackpadTwoFingerGesture = true;
|
|
17
|
-
const distance = gestureResponseDistance !== undefined ? gestureResponseDistance : gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? GESTURE_RESPONSE_DISTANCE_VERTICAL : GESTURE_RESPONSE_DISTANCE_HORIZONTAL;
|
|
18
|
-
if (gestureDirection === 'vertical') {
|
|
19
|
-
return {
|
|
20
|
-
maxDeltaX: 15,
|
|
21
|
-
minOffsetY: 5,
|
|
22
|
-
hitSlop: {
|
|
23
|
-
bottom: -layout.height + distance
|
|
24
|
-
},
|
|
25
|
-
enableTrackpadTwoFingerGesture
|
|
26
|
-
};
|
|
27
|
-
} else if (gestureDirection === 'vertical-inverted') {
|
|
28
|
-
return {
|
|
29
|
-
maxDeltaX: 15,
|
|
30
|
-
minOffsetY: -5,
|
|
31
|
-
hitSlop: {
|
|
32
|
-
top: -layout.height + distance
|
|
33
|
-
},
|
|
34
|
-
enableTrackpadTwoFingerGesture
|
|
35
|
-
};
|
|
36
|
-
} else {
|
|
37
|
-
const hitSlop = -layout.width + distance;
|
|
38
|
-
const invertedMultiplier = getInvertedMultiplier(gestureDirection, direction === 'rtl');
|
|
39
|
-
if (invertedMultiplier === 1) {
|
|
40
|
-
return {
|
|
41
|
-
minOffsetX: 5,
|
|
42
|
-
maxDeltaY: 20,
|
|
43
|
-
hitSlop: {
|
|
44
|
-
right: hitSlop
|
|
45
|
-
},
|
|
46
|
-
enableTrackpadTwoFingerGesture
|
|
47
|
-
};
|
|
48
|
-
} else {
|
|
49
|
-
return {
|
|
50
|
-
minOffsetX: -5,
|
|
51
|
-
maxDeltaY: 20,
|
|
52
|
-
hitSlop: {
|
|
53
|
-
left: hitSlop
|
|
54
|
-
},
|
|
55
|
-
enableTrackpadTwoFingerGesture
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
//# sourceMappingURL=gestureActivationCriteria.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { getInvertedMultiplier } from "./getInvertedMultiplier.js";
|
|
4
|
-
export function getDistanceForDirection(layout, gestureDirection, isRTL) {
|
|
5
|
-
const multiplier = getInvertedMultiplier(gestureDirection, isRTL);
|
|
6
|
-
switch (gestureDirection) {
|
|
7
|
-
case 'vertical':
|
|
8
|
-
case 'vertical-inverted':
|
|
9
|
-
return layout.height * multiplier;
|
|
10
|
-
case 'horizontal':
|
|
11
|
-
case 'horizontal-inverted':
|
|
12
|
-
return layout.width * multiplier;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=getDistanceForDirection.js.map
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export function getInvertedMultiplier(gestureDirection, isRTL) {
|
|
4
|
-
switch (gestureDirection) {
|
|
5
|
-
case 'vertical':
|
|
6
|
-
return 1;
|
|
7
|
-
case 'vertical-inverted':
|
|
8
|
-
return -1;
|
|
9
|
-
case 'horizontal':
|
|
10
|
-
return isRTL ? -1 : 1;
|
|
11
|
-
case 'horizontal-inverted':
|
|
12
|
-
return isRTL ? 1 : -1;
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=getInvertedMultiplier.js.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export const getModalRouteKeys = (routes, descriptors) => routes.reduce((acc, route) => {
|
|
4
|
-
const {
|
|
5
|
-
presentation
|
|
6
|
-
} = descriptors[route.key]?.options ?? {};
|
|
7
|
-
if (acc.length && !presentation || presentation === 'modal' || presentation === 'transparentModal') {
|
|
8
|
-
acc.push(route.key);
|
|
9
|
-
}
|
|
10
|
-
return acc;
|
|
11
|
-
}, []);
|
|
12
|
-
//# sourceMappingURL=getModalRoutesKeys.js.map
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import Color from 'color';
|
|
4
|
-
import { Platform } from 'react-native';
|
|
5
|
-
export function getShadowStyle({
|
|
6
|
-
offset,
|
|
7
|
-
radius,
|
|
8
|
-
opacity,
|
|
9
|
-
color = '#000'
|
|
10
|
-
}) {
|
|
11
|
-
const result = Platform.select({
|
|
12
|
-
web: {
|
|
13
|
-
boxShadow: `${offset.width}px ${offset.height}px ${radius}px ${Color(color).alpha(opacity).toString()}`
|
|
14
|
-
},
|
|
15
|
-
default: {
|
|
16
|
-
shadowOffset: offset,
|
|
17
|
-
shadowRadius: radius,
|
|
18
|
-
shadowColor: color,
|
|
19
|
-
shadowOpacity: opacity
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
//# sourceMappingURL=getShadowStyle.js.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
export function throttle(func, duration) {
|
|
4
|
-
let timeout;
|
|
5
|
-
return function (...args) {
|
|
6
|
-
if (timeout == null) {
|
|
7
|
-
func.apply(this, args);
|
|
8
|
-
timeout = setTimeout(() => {
|
|
9
|
-
timeout = undefined;
|
|
10
|
-
}, duration);
|
|
11
|
-
}
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
//# sourceMappingURL=throttle.js.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { CardAnimationContext } from "./CardAnimationContext.js";
|
|
5
|
-
export function useCardAnimation() {
|
|
6
|
-
const animation = React.useContext(CardAnimationContext);
|
|
7
|
-
if (animation === undefined) {
|
|
8
|
-
throw new Error("Couldn't find values for card animation. Are you inside a screen in Stack?");
|
|
9
|
-
}
|
|
10
|
-
return animation;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=useCardAnimation.js.map
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { GestureHandlerRefContext } from "./GestureHandlerRefContext.js";
|
|
5
|
-
export function useGestureHandlerRef() {
|
|
6
|
-
const ref = React.useContext(GestureHandlerRefContext);
|
|
7
|
-
if (ref === undefined) {
|
|
8
|
-
throw new Error("Couldn't find a ref for gesture handler. Are you inside a screen in Stack?");
|
|
9
|
-
}
|
|
10
|
-
return ref;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=useGestureHandlerRef.js.map
|
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Keyboard, TextInput } from 'react-native';
|
|
5
|
-
export function useKeyboardManager(isEnabled) {
|
|
6
|
-
// Numeric id of the previously focused text input
|
|
7
|
-
// When a gesture didn't change the tab, we can restore the focused input with this
|
|
8
|
-
const previouslyFocusedTextInputRef = React.useRef(undefined);
|
|
9
|
-
const startTimestampRef = React.useRef(0);
|
|
10
|
-
const keyboardTimeoutRef = React.useRef(undefined);
|
|
11
|
-
const clearKeyboardTimeout = React.useCallback(() => {
|
|
12
|
-
if (keyboardTimeoutRef.current !== undefined) {
|
|
13
|
-
clearTimeout(keyboardTimeoutRef.current);
|
|
14
|
-
keyboardTimeoutRef.current = undefined;
|
|
15
|
-
}
|
|
16
|
-
}, []);
|
|
17
|
-
const onPageChangeStart = React.useCallback(() => {
|
|
18
|
-
if (!isEnabled()) {
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
clearKeyboardTimeout();
|
|
22
|
-
const input = TextInput.State.currentlyFocusedInput();
|
|
23
|
-
|
|
24
|
-
// When a page change begins, blur the currently focused input
|
|
25
|
-
input?.blur();
|
|
26
|
-
|
|
27
|
-
// Store the id of this input so we can refocus it if change was cancelled
|
|
28
|
-
previouslyFocusedTextInputRef.current = input;
|
|
29
|
-
|
|
30
|
-
// Store timestamp for touch start
|
|
31
|
-
startTimestampRef.current = Date.now();
|
|
32
|
-
}, [clearKeyboardTimeout, isEnabled]);
|
|
33
|
-
const onPageChangeConfirm = React.useCallback(force => {
|
|
34
|
-
if (!isEnabled()) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
clearKeyboardTimeout();
|
|
38
|
-
if (force) {
|
|
39
|
-
// Always dismiss input, even if we don't have a ref to it
|
|
40
|
-
// We might not have the ref if onPageChangeStart was never called
|
|
41
|
-
// This can happen if page change was not from a gesture
|
|
42
|
-
Keyboard.dismiss();
|
|
43
|
-
} else {
|
|
44
|
-
const input = previouslyFocusedTextInputRef.current;
|
|
45
|
-
|
|
46
|
-
// Dismiss the keyboard only if an input was a focused before
|
|
47
|
-
// This makes sure we don't dismiss input on going back and focusing an input
|
|
48
|
-
input?.blur();
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
// Cleanup the ID on successful page change
|
|
52
|
-
previouslyFocusedTextInputRef.current = undefined;
|
|
53
|
-
}, [clearKeyboardTimeout, isEnabled]);
|
|
54
|
-
const onPageChangeCancel = React.useCallback(() => {
|
|
55
|
-
if (!isEnabled()) {
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
|
-
clearKeyboardTimeout();
|
|
59
|
-
|
|
60
|
-
// The page didn't change, we should restore the focus of text input
|
|
61
|
-
const input = previouslyFocusedTextInputRef.current;
|
|
62
|
-
if (input) {
|
|
63
|
-
// If the interaction was super short we should make sure keyboard won't hide again.
|
|
64
|
-
|
|
65
|
-
// Too fast input refocus will result only in keyboard flashing on screen and hiding right away.
|
|
66
|
-
// During first ~100ms keyboard will be dismissed no matter what,
|
|
67
|
-
// so we have to make sure it won't interrupt input refocus logic.
|
|
68
|
-
// That's why when the interaction is shorter than 100ms we add delay so it won't hide once again.
|
|
69
|
-
// Subtracting timestamps makes us sure the delay is executed only when needed.
|
|
70
|
-
if (Date.now() - startTimestampRef.current < 100) {
|
|
71
|
-
keyboardTimeoutRef.current = setTimeout(() => {
|
|
72
|
-
input?.focus();
|
|
73
|
-
previouslyFocusedTextInputRef.current = undefined;
|
|
74
|
-
}, 100);
|
|
75
|
-
} else {
|
|
76
|
-
input?.focus();
|
|
77
|
-
previouslyFocusedTextInputRef.current = undefined;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}, [clearKeyboardTimeout, isEnabled]);
|
|
81
|
-
React.useEffect(() => {
|
|
82
|
-
return () => clearKeyboardTimeout();
|
|
83
|
-
}, [clearKeyboardTimeout]);
|
|
84
|
-
return {
|
|
85
|
-
onPageChangeStart,
|
|
86
|
-
onPageChangeConfirm,
|
|
87
|
-
onPageChangeCancel
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
//# sourceMappingURL=useKeyboardManager.js.map
|