@amazon-devices/react-navigation__stack 8.0.9000000001 → 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/kepler-compatibility.json +2 -1
- package/lib/module/index.js +0 -34
- package/lib/module/views/Stack/CardStack.js.map +1 -1
- package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/index.tsx +0 -56
- 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 -498
- 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 -849
- package/src/views/Stack/StackView.tsx +0 -485
|
@@ -1,262 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import { Animated, Platform } from 'react-native';
|
|
4
|
-
const {
|
|
5
|
-
add,
|
|
6
|
-
multiply
|
|
7
|
-
} = Animated;
|
|
8
|
-
|
|
9
|
-
// Width of the screen in split layout on portrait mode on iPad Mini
|
|
10
|
-
// Keep in sync with HeaderBackButton.tsx
|
|
11
|
-
const IPAD_MINI_MEDIUM_WIDTH = 414;
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Standard UIKit style animation for the header where the title fades into the back button label.
|
|
15
|
-
*/
|
|
16
|
-
export function forUIKit({
|
|
17
|
-
current,
|
|
18
|
-
next,
|
|
19
|
-
direction,
|
|
20
|
-
layouts
|
|
21
|
-
}) {
|
|
22
|
-
const defaultOffset = 100;
|
|
23
|
-
const leftSpacing = 27 + (Platform.OS === 'ios' && layouts.screen.width >= IPAD_MINI_MEDIUM_WIDTH ? 5 // Additional padding on iPad specified in Header.tsx
|
|
24
|
-
: 0);
|
|
25
|
-
|
|
26
|
-
// The title and back button title should cross-fade to each other
|
|
27
|
-
// When screen is fully open, the title should be in center, and back title should be on left
|
|
28
|
-
// When screen is closing, the previous title will animate to back title's position
|
|
29
|
-
// And back title will animate to title's position
|
|
30
|
-
// We achieve this by calculating the offsets needed to translate title to back title's position and vice-versa
|
|
31
|
-
const leftLabelOffset = layouts.leftLabel ? (layouts.screen.width - layouts.leftLabel.width) / 2 - leftSpacing : defaultOffset;
|
|
32
|
-
const titleLeftOffset = layouts.title ? (layouts.screen.width - layouts.title.width) / 2 - leftSpacing : defaultOffset;
|
|
33
|
-
|
|
34
|
-
// When the current title is animating to right, it is centered in the right half of screen in middle of transition
|
|
35
|
-
// The back title also animates in from this position
|
|
36
|
-
const rightOffset = layouts.screen.width / 4;
|
|
37
|
-
const multiplier = direction === 'rtl' ? -1 : 1;
|
|
38
|
-
const progress = add(current.progress.interpolate({
|
|
39
|
-
inputRange: [0, 1],
|
|
40
|
-
outputRange: [0, 1],
|
|
41
|
-
extrapolate: 'clamp'
|
|
42
|
-
}), next ? next.progress.interpolate({
|
|
43
|
-
inputRange: [0, 1],
|
|
44
|
-
outputRange: [0, 1],
|
|
45
|
-
extrapolate: 'clamp'
|
|
46
|
-
}) : 0);
|
|
47
|
-
return {
|
|
48
|
-
leftButtonStyle: {
|
|
49
|
-
opacity: progress.interpolate({
|
|
50
|
-
inputRange: [0.3, 1, 1.5],
|
|
51
|
-
outputRange: [0, 1, 0]
|
|
52
|
-
})
|
|
53
|
-
},
|
|
54
|
-
leftLabelStyle: {
|
|
55
|
-
transform: [{
|
|
56
|
-
translateX: multiply(multiplier, progress.interpolate({
|
|
57
|
-
inputRange: [0, 1, 2],
|
|
58
|
-
outputRange: [leftLabelOffset, 0, -rightOffset]
|
|
59
|
-
}))
|
|
60
|
-
}]
|
|
61
|
-
},
|
|
62
|
-
rightButtonStyle: {
|
|
63
|
-
opacity: progress.interpolate({
|
|
64
|
-
inputRange: [0.3, 1, 1.5],
|
|
65
|
-
outputRange: [0, 1, 0]
|
|
66
|
-
})
|
|
67
|
-
},
|
|
68
|
-
titleStyle: {
|
|
69
|
-
opacity: progress.interpolate({
|
|
70
|
-
inputRange: [0, 0.5, 0.75, 1, 1.5],
|
|
71
|
-
outputRange: [0, 0, 0.1, 1, 0]
|
|
72
|
-
}),
|
|
73
|
-
transform: [{
|
|
74
|
-
translateX: multiply(multiplier, progress.interpolate({
|
|
75
|
-
inputRange: [0.5, 1, 2],
|
|
76
|
-
outputRange: [rightOffset, 0, -titleLeftOffset]
|
|
77
|
-
}))
|
|
78
|
-
}]
|
|
79
|
-
},
|
|
80
|
-
backgroundStyle: {
|
|
81
|
-
transform: [{
|
|
82
|
-
translateX: multiply(multiplier, progress.interpolate({
|
|
83
|
-
inputRange: [0, 1, 2],
|
|
84
|
-
outputRange: [layouts.screen.width, 0, -layouts.screen.width]
|
|
85
|
-
}))
|
|
86
|
-
}]
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
/**
|
|
92
|
-
* Simple fade animation for the header elements.
|
|
93
|
-
*/
|
|
94
|
-
export function forFade({
|
|
95
|
-
current,
|
|
96
|
-
next
|
|
97
|
-
}) {
|
|
98
|
-
const progress = add(current.progress.interpolate({
|
|
99
|
-
inputRange: [0, 1],
|
|
100
|
-
outputRange: [0, 1],
|
|
101
|
-
extrapolate: 'clamp'
|
|
102
|
-
}), next ? next.progress.interpolate({
|
|
103
|
-
inputRange: [0, 1],
|
|
104
|
-
outputRange: [0, 1],
|
|
105
|
-
extrapolate: 'clamp'
|
|
106
|
-
}) : 0);
|
|
107
|
-
const opacity = progress.interpolate({
|
|
108
|
-
inputRange: [0, 1, 2],
|
|
109
|
-
outputRange: [0, 1, 0]
|
|
110
|
-
});
|
|
111
|
-
return {
|
|
112
|
-
leftButtonStyle: {
|
|
113
|
-
opacity
|
|
114
|
-
},
|
|
115
|
-
rightButtonStyle: {
|
|
116
|
-
opacity
|
|
117
|
-
},
|
|
118
|
-
titleStyle: {
|
|
119
|
-
opacity
|
|
120
|
-
},
|
|
121
|
-
backgroundStyle: {
|
|
122
|
-
opacity: progress.interpolate({
|
|
123
|
-
inputRange: [0, 1, 1.9, 2],
|
|
124
|
-
outputRange: [0, 1, 1, 0]
|
|
125
|
-
})
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
/**
|
|
131
|
-
* Simple translate animation to translate the header to left.
|
|
132
|
-
*/
|
|
133
|
-
export function forSlideLeft({
|
|
134
|
-
current,
|
|
135
|
-
next,
|
|
136
|
-
direction,
|
|
137
|
-
layouts: {
|
|
138
|
-
screen
|
|
139
|
-
}
|
|
140
|
-
}) {
|
|
141
|
-
const isRTL = direction === 'rtl';
|
|
142
|
-
const progress = add(current.progress.interpolate({
|
|
143
|
-
inputRange: [0, 1],
|
|
144
|
-
outputRange: [0, 1],
|
|
145
|
-
extrapolate: 'clamp'
|
|
146
|
-
}), next ? next.progress.interpolate({
|
|
147
|
-
inputRange: [0, 1],
|
|
148
|
-
outputRange: [0, 1],
|
|
149
|
-
extrapolate: 'clamp'
|
|
150
|
-
}) : 0);
|
|
151
|
-
const translateX = progress.interpolate({
|
|
152
|
-
inputRange: [0, 1, 2],
|
|
153
|
-
outputRange: isRTL ? [-screen.width, 0, screen.width] : [screen.width, 0, -screen.width]
|
|
154
|
-
});
|
|
155
|
-
const transform = [{
|
|
156
|
-
translateX
|
|
157
|
-
}];
|
|
158
|
-
return {
|
|
159
|
-
leftButtonStyle: {
|
|
160
|
-
transform
|
|
161
|
-
},
|
|
162
|
-
rightButtonStyle: {
|
|
163
|
-
transform
|
|
164
|
-
},
|
|
165
|
-
titleStyle: {
|
|
166
|
-
transform
|
|
167
|
-
},
|
|
168
|
-
backgroundStyle: {
|
|
169
|
-
transform
|
|
170
|
-
}
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
/**
|
|
175
|
-
* Simple translate animation to translate the header to right.
|
|
176
|
-
*/
|
|
177
|
-
export function forSlideRight({
|
|
178
|
-
current,
|
|
179
|
-
next,
|
|
180
|
-
direction,
|
|
181
|
-
layouts: {
|
|
182
|
-
screen
|
|
183
|
-
}
|
|
184
|
-
}) {
|
|
185
|
-
const isRTL = direction === 'rtl';
|
|
186
|
-
const progress = add(current.progress.interpolate({
|
|
187
|
-
inputRange: [0, 1],
|
|
188
|
-
outputRange: [0, 1],
|
|
189
|
-
extrapolate: 'clamp'
|
|
190
|
-
}), next ? next.progress.interpolate({
|
|
191
|
-
inputRange: [0, 1],
|
|
192
|
-
outputRange: [0, 1],
|
|
193
|
-
extrapolate: 'clamp'
|
|
194
|
-
}) : 0);
|
|
195
|
-
const translateX = progress.interpolate({
|
|
196
|
-
inputRange: [0, 1, 2],
|
|
197
|
-
outputRange: isRTL ? [screen.width, 0, -screen.width] : [-screen.width, 0, screen.width]
|
|
198
|
-
});
|
|
199
|
-
const transform = [{
|
|
200
|
-
translateX
|
|
201
|
-
}];
|
|
202
|
-
return {
|
|
203
|
-
leftButtonStyle: {
|
|
204
|
-
transform
|
|
205
|
-
},
|
|
206
|
-
rightButtonStyle: {
|
|
207
|
-
transform
|
|
208
|
-
},
|
|
209
|
-
titleStyle: {
|
|
210
|
-
transform
|
|
211
|
-
},
|
|
212
|
-
backgroundStyle: {
|
|
213
|
-
transform
|
|
214
|
-
}
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
/**
|
|
219
|
-
* Simple translate animation to translate the header to slide up.
|
|
220
|
-
*/
|
|
221
|
-
export function forSlideUp({
|
|
222
|
-
current,
|
|
223
|
-
next,
|
|
224
|
-
layouts: {
|
|
225
|
-
header
|
|
226
|
-
}
|
|
227
|
-
}) {
|
|
228
|
-
const progress = add(current.progress.interpolate({
|
|
229
|
-
inputRange: [0, 1],
|
|
230
|
-
outputRange: [0, 1],
|
|
231
|
-
extrapolate: 'clamp'
|
|
232
|
-
}), next ? next.progress.interpolate({
|
|
233
|
-
inputRange: [0, 1],
|
|
234
|
-
outputRange: [0, 1],
|
|
235
|
-
extrapolate: 'clamp'
|
|
236
|
-
}) : 0);
|
|
237
|
-
const translateY = progress.interpolate({
|
|
238
|
-
inputRange: [0, 1, 2],
|
|
239
|
-
outputRange: [-header.height, 0, -header.height]
|
|
240
|
-
});
|
|
241
|
-
const transform = [{
|
|
242
|
-
translateY
|
|
243
|
-
}];
|
|
244
|
-
return {
|
|
245
|
-
leftButtonStyle: {
|
|
246
|
-
transform
|
|
247
|
-
},
|
|
248
|
-
rightButtonStyle: {
|
|
249
|
-
transform
|
|
250
|
-
},
|
|
251
|
-
titleStyle: {
|
|
252
|
-
transform
|
|
253
|
-
},
|
|
254
|
-
backgroundStyle: {
|
|
255
|
-
transform
|
|
256
|
-
}
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
export function forNoAnimation() {
|
|
260
|
-
return {};
|
|
261
|
-
}
|
|
262
|
-
//# sourceMappingURL=HeaderStyleInterpolators.js.map
|
|
@@ -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
|