@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.
Files changed (81) hide show
  1. package/SystemModules/amzn__react-navigation__stack-8.private.modules.txt +39 -34
  2. package/kepler-compatibility.json +4 -2
  3. package/lib/module/index.js +0 -34
  4. package/lib/typescript/src/index.d.ts +1 -1
  5. package/lib/typescript/src/index.d.ts.map +1 -1
  6. package/oss-attribution/attribution.txt +76 -0
  7. package/oss-attribution/licenseInfos.json +27 -0
  8. package/package.json +1 -1
  9. package/src/index.tsx +0 -55
  10. package/SystemBundles/98ca5eeb45684e3e5615c766e1d3a956fee53d14cd6c2318098c23c210bd76d7.bundle +0 -13464
  11. package/SystemBundles/98ca5eeb45684e3e5615c766e1d3a956fee53d14cd6c2318098c23c210bd76d7.map +0 -4638
  12. package/lib/module/TransitionConfigs/CardStyleInterpolators.js +0 -394
  13. package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js +0 -262
  14. package/lib/module/TransitionConfigs/TransitionPresets.js +0 -156
  15. package/lib/module/TransitionConfigs/TransitionSpecs.js +0 -124
  16. package/lib/module/navigators/createStackNavigator.js +0 -71
  17. package/lib/module/types.js +0 -4
  18. package/lib/module/utils/CardAnimationContext.js +0 -5
  19. package/lib/module/utils/GestureHandlerRefContext.js +0 -5
  20. package/lib/module/utils/ModalPresentationContext.js +0 -5
  21. package/lib/module/utils/conditional.js +0 -28
  22. package/lib/module/utils/findLastIndex.js +0 -11
  23. package/lib/module/utils/gestureActivationCriteria.js +0 -60
  24. package/lib/module/utils/getDistanceForDirection.js +0 -15
  25. package/lib/module/utils/getInvertedMultiplier.js +0 -15
  26. package/lib/module/utils/getModalRoutesKeys.js +0 -12
  27. package/lib/module/utils/getShadowStyle.js +0 -24
  28. package/lib/module/utils/throttle.js +0 -14
  29. package/lib/module/utils/useCardAnimation.js +0 -12
  30. package/lib/module/utils/useGestureHandlerRef.js +0 -12
  31. package/lib/module/utils/useKeyboardManager.js +0 -90
  32. package/lib/module/views/GestureHandler.android.js +0 -4
  33. package/lib/module/views/GestureHandler.ios.js +0 -4
  34. package/lib/module/views/GestureHandler.js +0 -21
  35. package/lib/module/views/GestureHandler.kepler.js +0 -4
  36. package/lib/module/views/GestureHandlerNative.js +0 -18
  37. package/lib/module/views/Header/Header.js +0 -56
  38. package/lib/module/views/Header/HeaderContainer.js +0 -128
  39. package/lib/module/views/Header/HeaderSegment.js +0 -142
  40. package/lib/module/views/Screens.js +0 -42
  41. package/lib/module/views/Stack/Card.js +0 -433
  42. package/lib/module/views/Stack/CardA11yWrapper.js +0 -43
  43. package/lib/module/views/Stack/CardContainer.js +0 -276
  44. package/lib/module/views/Stack/CardContent.js +0 -74
  45. package/lib/module/views/Stack/CardStack.js +0 -493
  46. package/lib/module/views/Stack/StackView.js +0 -339
  47. package/src/TransitionConfigs/CardStyleInterpolators.tsx +0 -460
  48. package/src/TransitionConfigs/HeaderStyleInterpolators.tsx +0 -286
  49. package/src/TransitionConfigs/TransitionPresets.tsx +0 -182
  50. package/src/TransitionConfigs/TransitionSpecs.tsx +0 -124
  51. package/src/navigators/createStackNavigator.tsx +0 -120
  52. package/src/types.tsx +0 -639
  53. package/src/utils/CardAnimationContext.tsx +0 -7
  54. package/src/utils/GestureHandlerRefContext.tsx +0 -5
  55. package/src/utils/ModalPresentationContext.tsx +0 -3
  56. package/src/utils/conditional.tsx +0 -33
  57. package/src/utils/findLastIndex.tsx +0 -9
  58. package/src/utils/gestureActivationCriteria.tsx +0 -70
  59. package/src/utils/getDistanceForDirection.tsx +0 -19
  60. package/src/utils/getInvertedMultiplier.tsx +0 -17
  61. package/src/utils/getModalRoutesKeys.ts +0 -21
  62. package/src/utils/getShadowStyle.tsx +0 -37
  63. package/src/utils/throttle.tsx +0 -16
  64. package/src/utils/useCardAnimation.tsx +0 -15
  65. package/src/utils/useGestureHandlerRef.tsx +0 -15
  66. package/src/utils/useKeyboardManager.tsx +0 -103
  67. package/src/views/GestureHandler.android.tsx +0 -1
  68. package/src/views/GestureHandler.ios.tsx +0 -1
  69. package/src/views/GestureHandler.kepler.tsx +0 -1
  70. package/src/views/GestureHandler.tsx +0 -23
  71. package/src/views/GestureHandlerNative.tsx +0 -23
  72. package/src/views/Header/Header.tsx +0 -73
  73. package/src/views/Header/HeaderContainer.tsx +0 -191
  74. package/src/views/Header/HeaderSegment.tsx +0 -203
  75. package/src/views/Screens.tsx +0 -45
  76. package/src/views/Stack/Card.tsx +0 -646
  77. package/src/views/Stack/CardA11yWrapper.tsx +0 -67
  78. package/src/views/Stack/CardContainer.tsx +0 -339
  79. package/src/views/Stack/CardContent.tsx +0 -92
  80. package/src/views/Stack/CardStack.tsx +0 -844
  81. package/src/views/Stack/StackView.tsx +0 -485
@@ -1,460 +0,0 @@
1
- import { Animated, Platform } from 'react-native';
2
-
3
- import type {
4
- StackCardInterpolatedStyle,
5
- StackCardInterpolationProps,
6
- } from '../types';
7
- import { conditional } from '../utils/conditional';
8
-
9
- const { add, multiply } = Animated;
10
-
11
- /**
12
- * Standard iOS-style slide in from the right.
13
- */
14
- export function forHorizontalIOS({
15
- current,
16
- next,
17
- inverted,
18
- layouts: { screen },
19
- }: StackCardInterpolationProps): StackCardInterpolatedStyle {
20
- const translateFocused = multiply(
21
- current.progress.interpolate({
22
- inputRange: [0, 1],
23
- outputRange: [screen.width, 0],
24
- extrapolate: 'clamp',
25
- }),
26
- inverted
27
- );
28
-
29
- const translateUnfocused = next
30
- ? multiply(
31
- next.progress.interpolate({
32
- inputRange: [0, 1],
33
- outputRange: [0, screen.width * -0.3],
34
- extrapolate: 'clamp',
35
- }),
36
- inverted
37
- )
38
- : 0;
39
-
40
- const overlayOpacity = current.progress.interpolate({
41
- inputRange: [0, 1],
42
- outputRange: [0, 0.07],
43
- extrapolate: 'clamp',
44
- });
45
-
46
- const shadowOpacity = current.progress.interpolate({
47
- inputRange: [0, 1],
48
- outputRange: [0, 0.3],
49
- extrapolate: 'clamp',
50
- });
51
-
52
- return {
53
- cardStyle: {
54
- transform: [
55
- // Translation for the animation of the current card
56
- { translateX: translateFocused },
57
- // Translation for the animation of the card on top of this
58
- { translateX: translateUnfocused },
59
- ],
60
- },
61
- overlayStyle: { opacity: overlayOpacity },
62
- shadowStyle: { shadowOpacity },
63
- };
64
- }
65
-
66
- /**
67
- * iOS-style slide in from the left.
68
- */
69
- export function forHorizontalIOSInverted({
70
- inverted,
71
- ...rest
72
- }: StackCardInterpolationProps): StackCardInterpolatedStyle {
73
- return forHorizontalIOS({
74
- ...rest,
75
- inverted: Animated.multiply(inverted, -1),
76
- });
77
- }
78
-
79
- /**
80
- * Standard iOS-style slide in from the bottom (used for modals).
81
- */
82
- export function forVerticalIOS({
83
- current,
84
- inverted,
85
- layouts: { screen },
86
- }: StackCardInterpolationProps): StackCardInterpolatedStyle {
87
- const translateY = multiply(
88
- current.progress.interpolate({
89
- inputRange: [0, 1],
90
- outputRange: [screen.height, 0],
91
- extrapolate: 'clamp',
92
- }),
93
- inverted
94
- );
95
-
96
- return {
97
- cardStyle: {
98
- transform: [{ translateY }],
99
- },
100
- };
101
- }
102
-
103
- /**
104
- * Standard iOS-style modal animation in iOS 13.
105
- */
106
- export function forModalPresentationIOS({
107
- index,
108
- current,
109
- next,
110
- inverted,
111
- layouts: { screen },
112
- insets,
113
- }: StackCardInterpolationProps): StackCardInterpolatedStyle {
114
- const hasNotchIos =
115
- Platform.OS === 'ios' &&
116
- !Platform.isPad &&
117
- !Platform.isTV &&
118
- insets.top > 20;
119
- const isLandscape = screen.width > screen.height;
120
- const topOffset = isLandscape ? 0 : 10;
121
- const statusBarHeight = insets.top;
122
- const aspectRatio = screen.height / screen.width;
123
-
124
- const progress = add(
125
- current.progress.interpolate({
126
- inputRange: [0, 1],
127
- outputRange: [0, 1],
128
- extrapolate: 'clamp',
129
- }),
130
- next
131
- ? next.progress.interpolate({
132
- inputRange: [0, 1],
133
- outputRange: [0, 1],
134
- extrapolate: 'clamp',
135
- })
136
- : 0
137
- );
138
-
139
- const isFirst = index === 0;
140
-
141
- const translateY = multiply(
142
- progress.interpolate({
143
- inputRange: [0, 1, 2],
144
- outputRange: [
145
- screen.height,
146
- isFirst ? 0 : topOffset,
147
- (isFirst ? statusBarHeight : 0) - topOffset * aspectRatio,
148
- ],
149
- }),
150
- inverted
151
- );
152
-
153
- const overlayOpacity = progress.interpolate({
154
- inputRange: [0, 1, 1.0001, 2],
155
- outputRange: [0, 0.3, 1, 1],
156
- });
157
-
158
- const scale = isLandscape
159
- ? 1
160
- : progress.interpolate({
161
- inputRange: [0, 1, 2],
162
- outputRange: [
163
- 1,
164
- 1,
165
- screen.width ? 1 - (topOffset * 2) / screen.width : 1,
166
- ],
167
- });
168
-
169
- const borderRadius = isLandscape
170
- ? 0
171
- : isFirst
172
- ? progress.interpolate({
173
- inputRange: [0, 1, 1.0001, 2],
174
- outputRange: [0, 0, hasNotchIos ? 38 : 0, 10],
175
- })
176
- : 10;
177
-
178
- return {
179
- cardStyle: {
180
- overflow: 'hidden',
181
- borderCurve: 'continuous',
182
- borderTopLeftRadius: borderRadius,
183
- borderTopRightRadius: borderRadius,
184
- // We don't need these for the animation
185
- // But different border radius for corners improves animation perf
186
- borderBottomLeftRadius: hasNotchIos ? borderRadius : 0,
187
- borderBottomRightRadius: hasNotchIos ? borderRadius : 0,
188
- marginTop: isFirst ? 0 : statusBarHeight,
189
- marginBottom: isFirst ? 0 : topOffset,
190
- transform: [{ translateY }, { scale }],
191
- },
192
- overlayStyle: { opacity: overlayOpacity },
193
- };
194
- }
195
-
196
- /**
197
- * Standard Android-style fade in from the bottom for Android Oreo.
198
- */
199
- export function forFadeFromBottomAndroid({
200
- current,
201
- inverted,
202
- layouts: { screen },
203
- closing,
204
- }: StackCardInterpolationProps): StackCardInterpolatedStyle {
205
- const translateY = multiply(
206
- current.progress.interpolate({
207
- inputRange: [0, 1],
208
- outputRange: [screen.height * 0.08, 0],
209
- extrapolate: 'clamp',
210
- }),
211
- inverted
212
- );
213
-
214
- const opacity = conditional(
215
- closing,
216
- current.progress,
217
- current.progress.interpolate({
218
- inputRange: [0, 0.5, 0.9, 1],
219
- outputRange: [0, 0.25, 0.7, 1],
220
- extrapolate: 'clamp',
221
- })
222
- );
223
-
224
- return {
225
- cardStyle: {
226
- opacity,
227
- transform: [{ translateY }],
228
- },
229
- };
230
- }
231
-
232
- /**
233
- * Standard Android-style reveal from the bottom for Android Pie.
234
- */
235
- export function forRevealFromBottomAndroid({
236
- current,
237
- next,
238
- inverted,
239
- layouts: { screen },
240
- }: StackCardInterpolationProps): StackCardInterpolatedStyle {
241
- const containerTranslateY = multiply(
242
- current.progress.interpolate({
243
- inputRange: [0, 1],
244
- outputRange: [screen.height, 0],
245
- extrapolate: 'clamp',
246
- }),
247
- inverted
248
- );
249
-
250
- const cardTranslateYFocused = multiply(
251
- current.progress.interpolate({
252
- inputRange: [0, 1],
253
- outputRange: [screen.height * (95.9 / 100) * -1, 0],
254
- extrapolate: 'clamp',
255
- }),
256
- inverted
257
- );
258
-
259
- const cardTranslateYUnfocused = next
260
- ? multiply(
261
- next.progress.interpolate({
262
- inputRange: [0, 1],
263
- outputRange: [0, screen.height * (2 / 100) * -1],
264
- extrapolate: 'clamp',
265
- }),
266
- inverted
267
- )
268
- : 0;
269
-
270
- const overlayOpacity = current.progress.interpolate({
271
- inputRange: [0, 0.36, 1],
272
- outputRange: [0, 0.1, 0.1],
273
- extrapolate: 'clamp',
274
- });
275
-
276
- return {
277
- containerStyle: {
278
- overflow: 'hidden',
279
- transform: [{ translateY: containerTranslateY }],
280
- },
281
- cardStyle: {
282
- transform: [
283
- { translateY: cardTranslateYFocused },
284
- { translateY: cardTranslateYUnfocused },
285
- ],
286
- },
287
- overlayStyle: { opacity: overlayOpacity },
288
- };
289
- }
290
-
291
- /**
292
- * Standard Android-style zoom for Android 10.
293
- */
294
- export function forScaleFromCenterAndroid({
295
- current,
296
- next,
297
- closing,
298
- }: StackCardInterpolationProps): StackCardInterpolatedStyle {
299
- const progress = add(
300
- current.progress.interpolate({
301
- inputRange: [0, 1],
302
- outputRange: [0, 1],
303
- extrapolate: 'clamp',
304
- }),
305
- next
306
- ? next.progress.interpolate({
307
- inputRange: [0, 1],
308
- outputRange: [0, 1],
309
- extrapolate: 'clamp',
310
- })
311
- : 0
312
- );
313
-
314
- const opacity = progress.interpolate({
315
- inputRange: [0, 0.75, 0.875, 1, 1.0825, 1.2075, 2],
316
- outputRange: [0, 0, 1, 1, 1, 1, 0],
317
- });
318
-
319
- const scale = conditional(
320
- closing,
321
- current.progress.interpolate({
322
- inputRange: [0, 1],
323
- outputRange: [0.925, 1],
324
- extrapolate: 'clamp',
325
- }),
326
- progress.interpolate({
327
- inputRange: [0, 1, 2],
328
- outputRange: [0.85, 1, 1.075],
329
- })
330
- );
331
-
332
- return {
333
- cardStyle: {
334
- opacity,
335
- transform: [{ scale }],
336
- },
337
- };
338
- }
339
-
340
- /**
341
- * Standard Android-style fade from right for Android 14.
342
- */
343
- export function forFadeFromRightAndroid({
344
- current,
345
- next,
346
- inverted,
347
- closing,
348
- }: StackCardInterpolationProps): StackCardInterpolatedStyle {
349
- const translateFocused = multiply(
350
- current.progress.interpolate({
351
- inputRange: [0, 1],
352
- outputRange: [96, 0],
353
- extrapolate: 'clamp',
354
- }),
355
- inverted
356
- );
357
-
358
- const translateUnfocused = next
359
- ? multiply(
360
- next.progress.interpolate({
361
- inputRange: [0, 1],
362
- outputRange: [0, -96],
363
- extrapolate: 'clamp',
364
- }),
365
- inverted
366
- )
367
- : 0;
368
-
369
- const opacity = conditional(
370
- closing,
371
- current.progress.interpolate({
372
- inputRange: [0, 1],
373
- outputRange: [0, 1],
374
- extrapolate: 'clamp',
375
- }),
376
- current.progress
377
- );
378
-
379
- return {
380
- cardStyle: {
381
- opacity,
382
- transform: [
383
- // Translation for the animation of the current card
384
- { translateX: translateFocused },
385
- // Translation for the animation of the card on top of this
386
- { translateX: translateUnfocused },
387
- ],
388
- },
389
- };
390
- }
391
-
392
- /**
393
- * Standard bottom sheet slide in from the bottom for Android.
394
- */
395
- export function forBottomSheetAndroid({
396
- current,
397
- inverted,
398
- layouts: { screen },
399
- closing,
400
- }: StackCardInterpolationProps): StackCardInterpolatedStyle {
401
- const translateY = multiply(
402
- current.progress.interpolate({
403
- inputRange: [0, 1],
404
- outputRange: [screen.height * 0.8, 0],
405
- extrapolate: 'clamp',
406
- }),
407
- inverted
408
- );
409
-
410
- const opacity = conditional(
411
- closing,
412
- current.progress,
413
- current.progress.interpolate({
414
- inputRange: [0, 1],
415
- outputRange: [0, 1],
416
- extrapolate: 'clamp',
417
- })
418
- );
419
-
420
- const overlayOpacity = current.progress.interpolate({
421
- inputRange: [0, 1],
422
- outputRange: [0, 0.3],
423
- extrapolate: 'clamp',
424
- });
425
-
426
- return {
427
- cardStyle: {
428
- opacity,
429
- transform: [{ translateY }],
430
- },
431
- overlayStyle: { opacity: overlayOpacity },
432
- };
433
- }
434
-
435
- /**
436
- * Simple fade animation for dialogs
437
- */
438
- export function forFadeFromCenter({
439
- current: { progress },
440
- }: StackCardInterpolationProps): StackCardInterpolatedStyle {
441
- return {
442
- cardStyle: {
443
- opacity: progress.interpolate({
444
- inputRange: [0, 0.5, 0.9, 1],
445
- outputRange: [0, 0.25, 0.7, 1],
446
- }),
447
- },
448
- overlayStyle: {
449
- opacity: progress.interpolate({
450
- inputRange: [0, 1],
451
- outputRange: [0, 0.5],
452
- extrapolate: 'clamp',
453
- }),
454
- },
455
- };
456
- }
457
-
458
- export function forNoAnimation(): StackCardInterpolatedStyle {
459
- return {};
460
- }