@amazon-devices/react-navigation__stack 7.0.1758683737 → 8.0.9000000000
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/SystemBundles/98ca5eeb45684e3e5615c766e1d3a956fee53d14cd6c2318098c23c210bd76d7.bundle +13464 -0
- package/SystemBundles/98ca5eeb45684e3e5615c766e1d3a956fee53d14cd6c2318098c23c210bd76d7.map +4638 -0
- package/SystemModules/amzn__react-navigation__stack-8.modules.txt +32 -0
- package/SystemModules/amzn__react-navigation__stack-8.private.modules.txt +92 -0
- package/SystemModules/keplerscript-system-bundle-config.json +4 -4
- package/kepler-compatibility.json +2 -4
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js +57 -1
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
- package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js +30 -16
- package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionPresets.js +32 -4
- package/lib/module/TransitionConfigs/TransitionPresets.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionSpecs.js +32 -2
- package/lib/module/TransitionConfigs/TransitionSpecs.js.map +1 -1
- package/lib/module/index.js +13 -11
- package/lib/module/index.js.map +1 -1
- package/lib/module/navigators/createStackNavigator.js +46 -48
- package/lib/module/navigators/createStackNavigator.js.map +1 -1
- package/lib/module/package.json +1 -0
- package/lib/module/types.js +2 -0
- package/lib/module/types.js.map +1 -1
- package/lib/module/utils/CardAnimationContext.js +3 -1
- package/lib/module/utils/CardAnimationContext.js.map +1 -1
- package/lib/module/utils/GestureHandlerRefContext.js +3 -1
- package/lib/module/utils/GestureHandlerRefContext.js.map +1 -1
- package/lib/module/utils/ModalPresentationContext.js +3 -2
- package/lib/module/utils/ModalPresentationContext.js.map +1 -1
- package/lib/module/utils/conditional.js +3 -1
- package/lib/module/utils/conditional.js.map +1 -1
- package/lib/module/utils/findLastIndex.js +4 -2
- package/lib/module/utils/findLastIndex.js.map +1 -1
- package/lib/module/utils/gestureActivationCriteria.js +60 -0
- package/lib/module/utils/gestureActivationCriteria.js.map +1 -0
- package/lib/module/utils/getDistanceForDirection.js +5 -3
- package/lib/module/utils/getDistanceForDirection.js.map +1 -1
- package/lib/module/utils/getInvertedMultiplier.js +5 -4
- package/lib/module/utils/getInvertedMultiplier.js.map +1 -1
- package/lib/module/utils/getModalRoutesKeys.js +12 -0
- package/lib/module/utils/getModalRoutesKeys.js.map +1 -0
- package/lib/module/utils/getShadowStyle.js +24 -0
- package/lib/module/utils/getShadowStyle.js.map +1 -0
- package/lib/module/utils/{debounce.js → throttle.js} +5 -4
- package/lib/module/utils/throttle.js.map +1 -0
- package/lib/module/utils/useCardAnimation.js +4 -2
- package/lib/module/utils/useCardAnimation.js.map +1 -1
- package/lib/module/utils/useGestureHandlerRef.js +5 -3
- package/lib/module/utils/useGestureHandlerRef.js.map +1 -1
- package/lib/module/utils/useKeyboardManager.js +8 -6
- package/lib/module/utils/useKeyboardManager.js.map +1 -1
- package/lib/module/views/GestureHandler.android.js +3 -1
- package/lib/module/views/GestureHandler.android.js.map +1 -1
- package/lib/module/views/GestureHandler.ios.js +3 -1
- package/lib/module/views/GestureHandler.ios.js.map +1 -1
- package/lib/module/views/GestureHandler.js +6 -1
- package/lib/module/views/GestureHandler.js.map +1 -1
- package/lib/module/views/GestureHandler.kepler.js +4 -0
- package/lib/module/views/GestureHandler.kepler.js.map +1 -0
- package/lib/module/views/GestureHandlerNative.js +13 -9
- package/lib/module/views/GestureHandlerNative.js.map +1 -1
- package/lib/module/views/Header/Header.js +12 -8
- package/lib/module/views/Header/Header.js.map +1 -1
- package/lib/module/views/Header/HeaderContainer.js +103 -93
- package/lib/module/views/Header/HeaderContainer.js.map +1 -1
- package/lib/module/views/Header/HeaderSegment.js +43 -31
- package/lib/module/views/Header/HeaderSegment.js.map +1 -1
- package/lib/module/views/Screens.js +17 -9
- package/lib/module/views/Screens.js.map +1 -1
- package/lib/module/views/Stack/Card.js +313 -338
- package/lib/module/views/Stack/Card.js.map +1 -1
- package/lib/module/views/Stack/CardA11yWrapper.js +43 -0
- package/lib/module/views/Stack/CardA11yWrapper.js.map +1 -0
- package/lib/module/views/Stack/CardContainer.js +116 -90
- package/lib/module/views/Stack/CardContainer.js.map +1 -1
- package/lib/module/views/Stack/CardContent.js +74 -0
- package/lib/module/views/Stack/CardContent.js.map +1 -0
- package/lib/module/views/Stack/CardStack.js +241 -180
- package/lib/module/views/Stack/CardStack.js.map +1 -1
- package/lib/module/views/Stack/StackView.js +80 -64
- package/lib/module/views/Stack/StackView.js.map +1 -1
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/TransitionConfigs/CardStyleInterpolators.d.ts +8 -0
- package/lib/typescript/src/TransitionConfigs/CardStyleInterpolators.d.ts.map +1 -1
- package/lib/typescript/src/TransitionConfigs/HeaderStyleInterpolators.d.ts +3 -3
- package/lib/typescript/src/TransitionConfigs/HeaderStyleInterpolators.d.ts.map +1 -1
- package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts +8 -0
- package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts.map +1 -1
- package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts +10 -0
- package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +8 -8
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/navigators/createStackNavigator.d.ts +15 -7
- package/lib/typescript/src/navigators/createStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +84 -24
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/utils/CardAnimationContext.d.ts +1 -2
- package/lib/typescript/src/utils/CardAnimationContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/GestureHandlerRefContext.d.ts +1 -2
- package/lib/typescript/src/utils/GestureHandlerRefContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/ModalPresentationContext.d.ts +1 -2
- package/lib/typescript/src/utils/ModalPresentationContext.d.ts.map +1 -1
- package/lib/typescript/src/utils/conditional.d.ts +1 -1
- package/lib/typescript/src/utils/conditional.d.ts.map +1 -1
- package/lib/typescript/src/utils/findLastIndex.d.ts +1 -1
- package/lib/typescript/src/utils/findLastIndex.d.ts.map +1 -1
- package/lib/typescript/src/utils/gestureActivationCriteria.d.ts +57 -0
- package/lib/typescript/src/utils/gestureActivationCriteria.d.ts.map +1 -0
- package/lib/typescript/src/utils/getDistanceForDirection.d.ts +1 -1
- package/lib/typescript/src/utils/getDistanceForDirection.d.ts.map +1 -1
- package/lib/typescript/src/utils/getInvertedMultiplier.d.ts +1 -1
- package/lib/typescript/src/utils/getInvertedMultiplier.d.ts.map +1 -1
- package/lib/typescript/src/utils/getModalRoutesKeys.d.ts +4 -0
- package/lib/typescript/src/utils/getModalRoutesKeys.d.ts.map +1 -0
- package/lib/typescript/src/utils/getShadowStyle.d.ts +27 -0
- package/lib/typescript/src/utils/getShadowStyle.d.ts.map +1 -0
- package/lib/typescript/src/utils/throttle.d.ts +2 -0
- package/lib/typescript/src/utils/throttle.d.ts.map +1 -0
- package/lib/typescript/src/utils/useCardAnimation.d.ts +1 -1
- package/lib/typescript/src/utils/useCardAnimation.d.ts.map +1 -1
- package/lib/typescript/src/utils/useGestureHandlerRef.d.ts +1 -1
- package/lib/typescript/src/utils/useGestureHandlerRef.d.ts.map +1 -1
- package/lib/typescript/src/utils/useKeyboardManager.d.ts +1 -1
- package/lib/typescript/src/utils/useKeyboardManager.d.ts.map +1 -1
- package/lib/typescript/src/views/GestureHandler.d.ts +3 -2
- package/lib/typescript/src/views/GestureHandler.d.ts.map +1 -1
- package/lib/typescript/src/views/GestureHandler.kepler.d.ts +2 -0
- package/lib/typescript/src/views/GestureHandler.kepler.d.ts.map +1 -0
- package/lib/typescript/src/views/GestureHandlerNative.d.ts +4 -5
- package/lib/typescript/src/views/GestureHandlerNative.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/Header.d.ts +1 -2
- package/lib/typescript/src/views/Header/Header.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts +4 -5
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts +2 -2
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +1 -1
- package/lib/typescript/src/views/Screens.d.ts +7 -5
- package/lib/typescript/src/views/Screens.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/Card.d.ts +14 -42
- package/lib/typescript/src/views/Stack/Card.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardA11yWrapper.d.ts +15 -0
- package/lib/typescript/src/views/Stack/CardA11yWrapper.d.ts.map +1 -0
- package/lib/typescript/src/views/Stack/CardContainer.d.ts +6 -8
- package/lib/typescript/src/views/Stack/CardContainer.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/CardContent.d.ts +13 -0
- package/lib/typescript/src/views/Stack/CardContent.d.ts.map +1 -0
- package/lib/typescript/src/views/Stack/CardStack.d.ts +8 -7
- package/lib/typescript/src/views/Stack/CardStack.d.ts.map +1 -1
- package/lib/typescript/src/views/Stack/StackView.d.ts +10 -81
- package/lib/typescript/src/views/Stack/StackView.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/TransitionConfigs/CardStyleInterpolators.tsx +72 -6
- package/src/TransitionConfigs/HeaderStyleInterpolators.tsx +43 -25
- package/src/TransitionConfigs/TransitionPresets.tsx +35 -5
- package/src/TransitionConfigs/TransitionSpecs.tsx +30 -2
- package/src/index.tsx +12 -7
- package/src/navigators/createStackNavigator.tsx +47 -63
- package/src/types.tsx +116 -24
- package/src/utils/CardAnimationContext.tsx +3 -3
- package/src/utils/GestureHandlerRefContext.tsx +2 -2
- package/src/utils/ModalPresentationContext.tsx +1 -3
- package/src/utils/conditional.tsx +1 -1
- package/src/utils/findLastIndex.tsx +2 -5
- package/src/utils/gestureActivationCriteria.tsx +70 -0
- package/src/utils/getDistanceForDirection.tsx +5 -4
- package/src/utils/getInvertedMultiplier.tsx +5 -6
- package/src/utils/getModalRoutesKeys.ts +21 -0
- package/src/utils/getShadowStyle.tsx +37 -0
- package/src/utils/throttle.tsx +16 -0
- package/src/utils/useCardAnimation.tsx +2 -2
- package/src/utils/useGestureHandlerRef.tsx +3 -3
- package/src/utils/useKeyboardManager.tsx +5 -7
- package/src/views/GestureHandler.kepler.tsx +1 -0
- package/src/views/GestureHandler.tsx +2 -2
- package/src/views/GestureHandlerNative.tsx +5 -5
- package/src/views/Header/Header.tsx +8 -7
- package/src/views/Header/HeaderContainer.tsx +23 -18
- package/src/views/Header/HeaderSegment.tsx +41 -43
- package/src/views/Screens.tsx +4 -2
- package/src/views/Stack/Card.tsx +480 -462
- package/src/views/Stack/CardA11yWrapper.tsx +67 -0
- package/src/views/Stack/CardContainer.tsx +127 -108
- package/src/views/Stack/CardContent.tsx +92 -0
- package/src/views/Stack/CardStack.tsx +370 -243
- package/src/views/Stack/StackView.tsx +73 -62
- package/SystemBundles/b598f9dfffcd611d6cd7d6a3c5ab3d66234659a03b40b6579fddb628e61b8313.bundle +0 -28538
- package/SystemBundles/b598f9dfffcd611d6cd7d6a3c5ab3d66234659a03b40b6579fddb628e61b8313.map +0 -1
- package/SystemModules/amzn__react-navigation__stack-7.modules.txt +0 -95
- package/SystemModules/amzn__react-navigation__stack-7.private.modules.txt +0 -185
- package/THIRD_PARTY_NOTICES.txt +0 -24
- package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js +0 -353
- package/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js.map +0 -1
- package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js +0 -259
- package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js.map +0 -1
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js +0 -134
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js.map +0 -1
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js +0 -100
- package/lib/commonjs/TransitionConfigs/TransitionSpecs.js.map +0 -1
- package/lib/commonjs/index.js +0 -69
- package/lib/commonjs/index.js.map +0 -1
- package/lib/commonjs/navigators/createStackNavigator.js +0 -82
- package/lib/commonjs/navigators/createStackNavigator.js.map +0 -1
- package/lib/commonjs/types.js +0 -6
- package/lib/commonjs/types.js.map +0 -1
- package/lib/commonjs/utils/CardAnimationContext.js +0 -11
- package/lib/commonjs/utils/CardAnimationContext.js.map +0 -1
- package/lib/commonjs/utils/GestureHandlerRefContext.js +0 -11
- package/lib/commonjs/utils/GestureHandlerRefContext.js.map +0 -1
- package/lib/commonjs/utils/ModalPresentationContext.js +0 -12
- package/lib/commonjs/utils/ModalPresentationContext.js.map +0 -1
- package/lib/commonjs/utils/conditional.js +0 -32
- package/lib/commonjs/utils/conditional.js.map +0 -1
- package/lib/commonjs/utils/debounce.js +0 -19
- package/lib/commonjs/utils/debounce.js.map +0 -1
- package/lib/commonjs/utils/findLastIndex.js +0 -15
- package/lib/commonjs/utils/findLastIndex.js.map +0 -1
- package/lib/commonjs/utils/getDistanceForDirection.js +0 -20
- package/lib/commonjs/utils/getDistanceForDirection.js.map +0 -1
- package/lib/commonjs/utils/getInvertedMultiplier.js +0 -20
- package/lib/commonjs/utils/getInvertedMultiplier.js.map +0 -1
- package/lib/commonjs/utils/memoize.js +0 -33
- package/lib/commonjs/utils/memoize.js.map +0 -1
- package/lib/commonjs/utils/useCardAnimation.js +0 -19
- package/lib/commonjs/utils/useCardAnimation.js.map +0 -1
- package/lib/commonjs/utils/useGestureHandlerRef.js +0 -19
- package/lib/commonjs/utils/useGestureHandlerRef.js.map +0 -1
- package/lib/commonjs/utils/useKeyboardManager.js +0 -96
- package/lib/commonjs/utils/useKeyboardManager.js.map +0 -1
- package/lib/commonjs/views/GestureHandler.android.js +0 -17
- package/lib/commonjs/views/GestureHandler.android.js.map +0 -1
- package/lib/commonjs/views/GestureHandler.ios.js +0 -17
- package/lib/commonjs/views/GestureHandler.ios.js.map +0 -1
- package/lib/commonjs/views/GestureHandler.js +0 -24
- package/lib/commonjs/views/GestureHandler.js.map +0 -1
- package/lib/commonjs/views/GestureHandlerNative.js +0 -34
- package/lib/commonjs/views/GestureHandlerNative.js.map +0 -1
- package/lib/commonjs/views/Header/Header.js +0 -61
- package/lib/commonjs/views/Header/Header.js.map +0 -1
- package/lib/commonjs/views/Header/HeaderContainer.js +0 -127
- package/lib/commonjs/views/Header/HeaderContainer.js.map +0 -1
- package/lib/commonjs/views/Header/HeaderSegment.js +0 -139
- package/lib/commonjs/views/Header/HeaderSegment.js.map +0 -1
- package/lib/commonjs/views/ModalStatusBarManager.js +0 -42
- package/lib/commonjs/views/ModalStatusBarManager.js.map +0 -1
- package/lib/commonjs/views/Screens.js +0 -44
- package/lib/commonjs/views/Screens.js.map +0 -1
- package/lib/commonjs/views/Stack/Card.js +0 -469
- package/lib/commonjs/views/Stack/Card.js.map +0 -1
- package/lib/commonjs/views/Stack/CardContainer.js +0 -259
- package/lib/commonjs/views/Stack/CardContainer.js.map +0 -1
- package/lib/commonjs/views/Stack/CardSheet.js +0 -54
- package/lib/commonjs/views/Stack/CardSheet.js.map +0 -1
- package/lib/commonjs/views/Stack/CardStack.js +0 -442
- package/lib/commonjs/views/Stack/CardStack.js.map +0 -1
- package/lib/commonjs/views/Stack/StackView.js +0 -333
- package/lib/commonjs/views/Stack/StackView.js.map +0 -1
- package/lib/module/utils/debounce.js.map +0 -1
- package/lib/module/utils/memoize.js +0 -27
- package/lib/module/utils/memoize.js.map +0 -1
- package/lib/module/views/ModalStatusBarManager.js +0 -34
- package/lib/module/views/ModalStatusBarManager.js.map +0 -1
- package/lib/module/views/Stack/CardSheet.js +0 -46
- package/lib/module/views/Stack/CardSheet.js.map +0 -1
- package/lib/typescript/src/utils/debounce.d.ts +0 -2
- package/lib/typescript/src/utils/debounce.d.ts.map +0 -1
- package/lib/typescript/src/utils/memoize.d.ts +0 -2
- package/lib/typescript/src/utils/memoize.d.ts.map +0 -1
- package/lib/typescript/src/views/ModalStatusBarManager.d.ts +0 -12
- package/lib/typescript/src/views/ModalStatusBarManager.d.ts.map +0 -1
- package/lib/typescript/src/views/Stack/CardSheet.d.ts +0 -15
- package/lib/typescript/src/views/Stack/CardSheet.d.ts.map +0 -1
- package/src/utils/debounce.tsx +0 -17
- package/src/utils/memoize.tsx +0 -33
- package/src/views/ModalStatusBarManager.tsx +0 -50
- package/src/views/Stack/CardSheet.tsx +0 -61
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import { Animated,
|
|
1
|
+
import { Animated, Platform } from 'react-native';
|
|
2
2
|
|
|
3
3
|
import type {
|
|
4
4
|
StackHeaderInterpolatedStyle,
|
|
5
5
|
StackHeaderInterpolationProps,
|
|
6
6
|
} from '../types';
|
|
7
7
|
|
|
8
|
-
const { add } = Animated;
|
|
8
|
+
const { add, multiply } = Animated;
|
|
9
|
+
|
|
10
|
+
// Width of the screen in split layout on portrait mode on iPad Mini
|
|
11
|
+
// Keep in sync with HeaderBackButton.tsx
|
|
12
|
+
const IPAD_MINI_MEDIUM_WIDTH = 414;
|
|
9
13
|
|
|
10
14
|
/**
|
|
11
15
|
* Standard UIKit style animation for the header where the title fades into the back button label.
|
|
@@ -13,10 +17,15 @@ const { add } = Animated;
|
|
|
13
17
|
export function forUIKit({
|
|
14
18
|
current,
|
|
15
19
|
next,
|
|
20
|
+
direction,
|
|
16
21
|
layouts,
|
|
17
22
|
}: StackHeaderInterpolationProps): StackHeaderInterpolatedStyle {
|
|
18
23
|
const defaultOffset = 100;
|
|
19
|
-
const leftSpacing =
|
|
24
|
+
const leftSpacing =
|
|
25
|
+
27 +
|
|
26
|
+
(Platform.OS === 'ios' && layouts.screen.width >= IPAD_MINI_MEDIUM_WIDTH
|
|
27
|
+
? 5 // Additional padding on iPad specified in Header.tsx
|
|
28
|
+
: 0);
|
|
20
29
|
|
|
21
30
|
// The title and back button title should cross-fade to each other
|
|
22
31
|
// When screen is fully open, the title should be in center, and back title should be on left
|
|
@@ -34,6 +43,8 @@ export function forUIKit({
|
|
|
34
43
|
// The back title also animates in from this position
|
|
35
44
|
const rightOffset = layouts.screen.width / 4;
|
|
36
45
|
|
|
46
|
+
const multiplier = direction === 'rtl' ? -1 : 1;
|
|
47
|
+
|
|
37
48
|
const progress = add(
|
|
38
49
|
current.progress.interpolate({
|
|
39
50
|
inputRange: [0, 1],
|
|
@@ -59,12 +70,13 @@ export function forUIKit({
|
|
|
59
70
|
leftLabelStyle: {
|
|
60
71
|
transform: [
|
|
61
72
|
{
|
|
62
|
-
translateX:
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
: [leftLabelOffset, 0, -rightOffset],
|
|
67
|
-
|
|
73
|
+
translateX: multiply(
|
|
74
|
+
multiplier,
|
|
75
|
+
progress.interpolate({
|
|
76
|
+
inputRange: [0, 1, 2],
|
|
77
|
+
outputRange: [leftLabelOffset, 0, -rightOffset],
|
|
78
|
+
})
|
|
79
|
+
),
|
|
68
80
|
},
|
|
69
81
|
],
|
|
70
82
|
},
|
|
@@ -76,29 +88,31 @@ export function forUIKit({
|
|
|
76
88
|
},
|
|
77
89
|
titleStyle: {
|
|
78
90
|
opacity: progress.interpolate({
|
|
79
|
-
inputRange: [0, 0.
|
|
80
|
-
outputRange: [0, 0.1, 1, 0],
|
|
91
|
+
inputRange: [0, 0.5, 0.75, 1, 1.5],
|
|
92
|
+
outputRange: [0, 0, 0.1, 1, 0],
|
|
81
93
|
}),
|
|
82
94
|
transform: [
|
|
83
95
|
{
|
|
84
|
-
translateX:
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
: [rightOffset, 0, -titleLeftOffset],
|
|
89
|
-
|
|
96
|
+
translateX: multiply(
|
|
97
|
+
multiplier,
|
|
98
|
+
progress.interpolate({
|
|
99
|
+
inputRange: [0.5, 1, 2],
|
|
100
|
+
outputRange: [rightOffset, 0, -titleLeftOffset],
|
|
101
|
+
})
|
|
102
|
+
),
|
|
90
103
|
},
|
|
91
104
|
],
|
|
92
105
|
},
|
|
93
106
|
backgroundStyle: {
|
|
94
107
|
transform: [
|
|
95
108
|
{
|
|
96
|
-
translateX:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
: [layouts.screen.width, 0, -layouts.screen.width],
|
|
101
|
-
|
|
109
|
+
translateX: multiply(
|
|
110
|
+
multiplier,
|
|
111
|
+
progress.interpolate({
|
|
112
|
+
inputRange: [0, 1, 2],
|
|
113
|
+
outputRange: [layouts.screen.width, 0, -layouts.screen.width],
|
|
114
|
+
})
|
|
115
|
+
),
|
|
102
116
|
},
|
|
103
117
|
],
|
|
104
118
|
},
|
|
@@ -151,8 +165,10 @@ export function forFade({
|
|
|
151
165
|
export function forSlideLeft({
|
|
152
166
|
current,
|
|
153
167
|
next,
|
|
168
|
+
direction,
|
|
154
169
|
layouts: { screen },
|
|
155
170
|
}: StackHeaderInterpolationProps): StackHeaderInterpolatedStyle {
|
|
171
|
+
const isRTL = direction === 'rtl';
|
|
156
172
|
const progress = add(
|
|
157
173
|
current.progress.interpolate({
|
|
158
174
|
inputRange: [0, 1],
|
|
@@ -170,7 +186,7 @@ export function forSlideLeft({
|
|
|
170
186
|
|
|
171
187
|
const translateX = progress.interpolate({
|
|
172
188
|
inputRange: [0, 1, 2],
|
|
173
|
-
outputRange:
|
|
189
|
+
outputRange: isRTL
|
|
174
190
|
? [-screen.width, 0, screen.width]
|
|
175
191
|
: [screen.width, 0, -screen.width],
|
|
176
192
|
});
|
|
@@ -191,8 +207,10 @@ export function forSlideLeft({
|
|
|
191
207
|
export function forSlideRight({
|
|
192
208
|
current,
|
|
193
209
|
next,
|
|
210
|
+
direction,
|
|
194
211
|
layouts: { screen },
|
|
195
212
|
}: StackHeaderInterpolationProps): StackHeaderInterpolatedStyle {
|
|
213
|
+
const isRTL = direction === 'rtl';
|
|
196
214
|
const progress = add(
|
|
197
215
|
current.progress.interpolate({
|
|
198
216
|
inputRange: [0, 1],
|
|
@@ -210,7 +228,7 @@ export function forSlideRight({
|
|
|
210
228
|
|
|
211
229
|
const translateX = progress.interpolate({
|
|
212
230
|
inputRange: [0, 1, 2],
|
|
213
|
-
outputRange:
|
|
231
|
+
outputRange: isRTL
|
|
214
232
|
? [screen.width, 0, -screen.width]
|
|
215
233
|
: [-screen.width, 0, screen.width],
|
|
216
234
|
});
|
|
@@ -5,7 +5,9 @@ import {
|
|
|
5
5
|
forBottomSheetAndroid,
|
|
6
6
|
forFadeFromBottomAndroid,
|
|
7
7
|
forFadeFromCenter as forFadeCard,
|
|
8
|
+
forFadeFromRightAndroid,
|
|
8
9
|
forHorizontalIOS,
|
|
10
|
+
forHorizontalIOSInverted,
|
|
9
11
|
forModalPresentationIOS,
|
|
10
12
|
forRevealFromBottomAndroid,
|
|
11
13
|
forScaleFromCenterAndroid,
|
|
@@ -24,6 +26,7 @@ import {
|
|
|
24
26
|
|
|
25
27
|
const ANDROID_VERSION_PIE = 28;
|
|
26
28
|
const ANDROID_VERSION_10 = 29;
|
|
29
|
+
const ANDROID_VERSION_14 = 34;
|
|
27
30
|
|
|
28
31
|
/**
|
|
29
32
|
* Standard iOS navigation transition.
|
|
@@ -103,6 +106,19 @@ export const ScaleFromCenterAndroid: TransitionPreset = {
|
|
|
103
106
|
headerStyleInterpolator: forFade,
|
|
104
107
|
};
|
|
105
108
|
|
|
109
|
+
/**
|
|
110
|
+
* Standard Android navigation transition when opening or closing an Activity on Android 14.
|
|
111
|
+
*/
|
|
112
|
+
export const FadeFromRightAndroid: TransitionPreset = {
|
|
113
|
+
gestureDirection: 'horizontal',
|
|
114
|
+
transitionSpec: {
|
|
115
|
+
open: FadeInFromBottomAndroidSpec,
|
|
116
|
+
close: FadeOutToBottomAndroidSpec,
|
|
117
|
+
},
|
|
118
|
+
cardStyleInterpolator: forFadeFromRightAndroid,
|
|
119
|
+
headerStyleInterpolator: forFade,
|
|
120
|
+
};
|
|
121
|
+
|
|
106
122
|
/**
|
|
107
123
|
* Standard bottom sheet slide transition for Android 10.
|
|
108
124
|
*/
|
|
@@ -133,13 +149,17 @@ export const ModalFadeTransition: TransitionPreset = {
|
|
|
133
149
|
* Default navigation transition for the current platform.
|
|
134
150
|
*/
|
|
135
151
|
export const DefaultTransition = Platform.select({
|
|
152
|
+
// @ts-ignore - add default value for kepler (leaving for easy override)
|
|
153
|
+
kepler: ScaleFromCenterAndroid,
|
|
136
154
|
ios: SlideFromRightIOS,
|
|
137
155
|
android:
|
|
138
|
-
Platform.Version >=
|
|
139
|
-
?
|
|
140
|
-
: Platform.Version >=
|
|
141
|
-
|
|
142
|
-
|
|
156
|
+
Number(Platform.Version) >= ANDROID_VERSION_14
|
|
157
|
+
? FadeFromRightAndroid
|
|
158
|
+
: Number(Platform.Version) >= ANDROID_VERSION_10
|
|
159
|
+
? ScaleFromCenterAndroid
|
|
160
|
+
: Number(Platform.Version) >= ANDROID_VERSION_PIE
|
|
161
|
+
? RevealFromBottomAndroid
|
|
162
|
+
: FadeFromBottomAndroid,
|
|
143
163
|
default: ScaleFromCenterAndroid,
|
|
144
164
|
});
|
|
145
165
|
|
|
@@ -147,6 +167,16 @@ export const DefaultTransition = Platform.select({
|
|
|
147
167
|
* Default modal transition for the current platform.
|
|
148
168
|
*/
|
|
149
169
|
export const ModalTransition = Platform.select({
|
|
170
|
+
// @ts-ignore - add default value for kepler (leaving for easy override)
|
|
171
|
+
kepler: BottomSheetAndroid,
|
|
150
172
|
ios: ModalPresentationIOS,
|
|
151
173
|
default: BottomSheetAndroid,
|
|
152
174
|
});
|
|
175
|
+
|
|
176
|
+
/**
|
|
177
|
+
* Slide from left transition.
|
|
178
|
+
*/
|
|
179
|
+
export const SlideFromLeftIOS: TransitionPreset = {
|
|
180
|
+
...SlideFromRightIOS,
|
|
181
|
+
cardStyleInterpolator: forHorizontalIOSInverted,
|
|
182
|
+
};
|
|
@@ -51,7 +51,7 @@ export const RevealFromBottomAndroidSpec: TransitionSpec = {
|
|
|
51
51
|
duration: 425,
|
|
52
52
|
// This is super rough approximation of the path used for the curve by android
|
|
53
53
|
// See http://aosp.opersys.com/xref/android-9.0.0_r47/xref/frameworks/base/core/res/res/interpolator/fast_out_extra_slow_in.xml
|
|
54
|
-
easing: Easing.bezier(0.
|
|
54
|
+
easing: Easing.bezier(0.20833, 0.82, 0.25, 1),
|
|
55
55
|
},
|
|
56
56
|
};
|
|
57
57
|
|
|
@@ -65,7 +65,35 @@ export const ScaleFromCenterAndroidSpec: TransitionSpec = {
|
|
|
65
65
|
duration: 400,
|
|
66
66
|
// This is super rough approximation of the path used for the curve by android
|
|
67
67
|
// See http://aosp.opersys.com/xref/android-10.0.0_r2/xref/frameworks/base/core/res/res/interpolator/fast_out_extra_slow_in.xml
|
|
68
|
-
easing: Easing.bezier(0.
|
|
68
|
+
easing: Easing.bezier(0.20833, 0.82, 0.25, 1),
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Approximate configuration for activity open animation from Android 14.
|
|
74
|
+
* See https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r51/core/res/res/anim/activity_open_enter.xml
|
|
75
|
+
*/
|
|
76
|
+
export const FadeInFromRightAndroidSpec: TransitionSpec = {
|
|
77
|
+
animation: 'timing',
|
|
78
|
+
config: {
|
|
79
|
+
duration: 450,
|
|
80
|
+
// This is super rough approximation of the path used for the curve by android
|
|
81
|
+
// 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
|
|
82
|
+
easing: Easing.bezier(0.20833, 0.82, 0.25, 1),
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Approximate configuration for activity close animation from Android 14.
|
|
88
|
+
* See https://android.googlesource.com/platform/frameworks/base/+/refs/tags/android-14.0.0_r51/core/res/res/anim/activity_close_exit.xml
|
|
89
|
+
*/
|
|
90
|
+
export const FadeOutToLeftAndroidSpec: TransitionSpec = {
|
|
91
|
+
animation: 'timing',
|
|
92
|
+
config: {
|
|
93
|
+
duration: 450,
|
|
94
|
+
// This is super rough approximation of the path used for the curve by android
|
|
95
|
+
// 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
|
|
96
|
+
easing: Easing.bezier(0.20833, 0.82, 0.25, 1),
|
|
69
97
|
},
|
|
70
98
|
};
|
|
71
99
|
|
package/src/index.tsx
CHANGED
|
@@ -6,13 +6,13 @@ import * as TransitionSpecs from './TransitionConfigs/TransitionSpecs';
|
|
|
6
6
|
/**
|
|
7
7
|
* Navigators
|
|
8
8
|
*/
|
|
9
|
-
export {
|
|
9
|
+
export { createStackNavigator } from './navigators/createStackNavigator';
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Views
|
|
13
13
|
*/
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
14
|
+
export { Header } from './views/Header/Header';
|
|
15
|
+
export { StackView } from './views/Stack/StackView';
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Transition presets
|
|
@@ -27,25 +27,30 @@ export {
|
|
|
27
27
|
/**
|
|
28
28
|
* Utilities
|
|
29
29
|
*/
|
|
30
|
-
export {
|
|
31
|
-
export {
|
|
32
|
-
export {
|
|
33
|
-
export {
|
|
30
|
+
export { CardAnimationContext } from './utils/CardAnimationContext';
|
|
31
|
+
export { GestureHandlerRefContext } from './utils/GestureHandlerRefContext';
|
|
32
|
+
export { useCardAnimation } from './utils/useCardAnimation';
|
|
33
|
+
export { useGestureHandlerRef } from './utils/useGestureHandlerRef';
|
|
34
34
|
|
|
35
35
|
/**
|
|
36
36
|
* Types
|
|
37
37
|
*/
|
|
38
38
|
export type {
|
|
39
|
+
StackAnimationName,
|
|
39
40
|
StackCardInterpolatedStyle,
|
|
40
41
|
StackCardInterpolationProps,
|
|
41
42
|
StackCardStyleInterpolator,
|
|
42
43
|
StackHeaderInterpolatedStyle,
|
|
43
44
|
StackHeaderInterpolationProps,
|
|
45
|
+
StackHeaderLeftProps,
|
|
44
46
|
StackHeaderProps,
|
|
47
|
+
StackHeaderRightProps,
|
|
45
48
|
StackHeaderStyleInterpolator,
|
|
46
49
|
StackNavigationEventMap,
|
|
47
50
|
StackNavigationOptions,
|
|
48
51
|
StackNavigationProp,
|
|
52
|
+
StackNavigatorProps,
|
|
53
|
+
StackOptionsArgs,
|
|
49
54
|
StackScreenProps,
|
|
50
55
|
TransitionPreset,
|
|
51
56
|
} from './types';
|
|
@@ -1,80 +1,43 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createNavigatorFactory,
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
ParamListBase,
|
|
6
|
-
StackActionHelpers,
|
|
3
|
+
type EventArg,
|
|
4
|
+
type NavigatorTypeBagBase,
|
|
5
|
+
type ParamListBase,
|
|
6
|
+
type StackActionHelpers,
|
|
7
7
|
StackActions,
|
|
8
|
-
StackNavigationState,
|
|
8
|
+
type StackNavigationState,
|
|
9
9
|
StackRouter,
|
|
10
|
-
StackRouterOptions,
|
|
10
|
+
type StackRouterOptions,
|
|
11
|
+
type StaticConfig,
|
|
12
|
+
type TypedNavigator,
|
|
13
|
+
useLocale,
|
|
11
14
|
useNavigationBuilder,
|
|
12
15
|
} from '@amazon-devices/react-navigation__native';
|
|
13
16
|
import * as React from 'react';
|
|
14
|
-
import warnOnce from 'warn-once';
|
|
15
17
|
|
|
16
18
|
import type {
|
|
17
|
-
StackHeaderMode,
|
|
18
|
-
StackNavigationConfig,
|
|
19
19
|
StackNavigationEventMap,
|
|
20
20
|
StackNavigationOptions,
|
|
21
|
+
StackNavigationProp,
|
|
22
|
+
StackNavigatorProps,
|
|
21
23
|
} from '../types';
|
|
22
|
-
import StackView from '../views/Stack/StackView';
|
|
23
|
-
|
|
24
|
-
type Props = DefaultNavigatorOptions<
|
|
25
|
-
ParamListBase,
|
|
26
|
-
StackNavigationState<ParamListBase>,
|
|
27
|
-
StackNavigationOptions,
|
|
28
|
-
StackNavigationEventMap
|
|
29
|
-
> &
|
|
30
|
-
StackRouterOptions &
|
|
31
|
-
StackNavigationConfig;
|
|
24
|
+
import { StackView } from '../views/Stack/StackView';
|
|
32
25
|
|
|
33
26
|
function StackNavigator({
|
|
34
27
|
id,
|
|
35
28
|
initialRouteName,
|
|
29
|
+
UNSTABLE_routeNamesChangeBehavior,
|
|
36
30
|
children,
|
|
31
|
+
layout,
|
|
37
32
|
screenListeners,
|
|
38
33
|
screenOptions,
|
|
34
|
+
screenLayout,
|
|
35
|
+
UNSTABLE_router,
|
|
39
36
|
...rest
|
|
40
|
-
}:
|
|
41
|
-
|
|
42
|
-
const mode = rest.mode as 'card' | 'modal' | undefined;
|
|
43
|
-
|
|
44
|
-
warnOnce(
|
|
45
|
-
mode != null,
|
|
46
|
-
`Stack Navigator: 'mode="${mode}"' is deprecated. Use 'presentation: "${mode}"' in 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/stack-navigator#presentation for more details.`
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
// @ts-expect-error: headerMode='none' is deprecated
|
|
50
|
-
const headerMode = rest.headerMode as StackHeaderMode | 'none' | undefined;
|
|
51
|
-
|
|
52
|
-
warnOnce(
|
|
53
|
-
headerMode === 'none',
|
|
54
|
-
`Stack Navigator: 'headerMode="none"' is deprecated. Use 'headerShown: false' in 'screenOptions' instead.\n\nSee https://reactnavigation.org/docs/stack-navigator/#headershown for more details.`
|
|
55
|
-
);
|
|
56
|
-
|
|
57
|
-
warnOnce(
|
|
58
|
-
headerMode != null && headerMode !== 'none',
|
|
59
|
-
`Stack Navigator: 'headerMode' is moved to 'options'. Moved it to 'screenOptions' to keep current behavior.\n\nSee https://reactnavigation.org/docs/stack-navigator/#headermode for more details.`
|
|
60
|
-
);
|
|
61
|
-
|
|
62
|
-
// @ts-expect-error: headerMode='none' is deprecated
|
|
63
|
-
const keyboardHandlingEnabled = rest.keyboardHandlingEnabled;
|
|
64
|
-
|
|
65
|
-
warnOnce(
|
|
66
|
-
keyboardHandlingEnabled !== undefined,
|
|
67
|
-
`Stack Navigator: 'keyboardHandlingEnabled' is moved to 'options'. Moved it to 'screenOptions' to keep current behavior.\n\nSee https://reactnavigation.org/docs/stack-navigator/#keyboardhandlingenabled for more details.`
|
|
68
|
-
);
|
|
37
|
+
}: StackNavigatorProps) {
|
|
38
|
+
const { direction } = useLocale();
|
|
69
39
|
|
|
70
|
-
const
|
|
71
|
-
presentation: mode,
|
|
72
|
-
headerShown: headerMode ? headerMode !== 'none' : true,
|
|
73
|
-
headerMode: headerMode && headerMode !== 'none' ? headerMode : undefined,
|
|
74
|
-
keyboardHandlingEnabled,
|
|
75
|
-
};
|
|
76
|
-
|
|
77
|
-
const { state, descriptors, navigation, NavigationContent } =
|
|
40
|
+
const { state, describe, descriptors, navigation, NavigationContent } =
|
|
78
41
|
useNavigationBuilder<
|
|
79
42
|
StackNavigationState<ParamListBase>,
|
|
80
43
|
StackRouterOptions,
|
|
@@ -84,10 +47,13 @@ function StackNavigator({
|
|
|
84
47
|
>(StackRouter, {
|
|
85
48
|
id,
|
|
86
49
|
initialRouteName,
|
|
50
|
+
UNSTABLE_routeNamesChangeBehavior,
|
|
87
51
|
children,
|
|
52
|
+
layout,
|
|
88
53
|
screenListeners,
|
|
89
54
|
screenOptions,
|
|
90
|
-
|
|
55
|
+
screenLayout,
|
|
56
|
+
UNSTABLE_router,
|
|
91
57
|
});
|
|
92
58
|
|
|
93
59
|
React.useEffect(
|
|
@@ -120,7 +86,9 @@ function StackNavigator({
|
|
|
120
86
|
<NavigationContent>
|
|
121
87
|
<StackView
|
|
122
88
|
{...rest}
|
|
89
|
+
direction={direction}
|
|
123
90
|
state={state}
|
|
91
|
+
describe={describe}
|
|
124
92
|
descriptors={descriptors}
|
|
125
93
|
navigation={navigation}
|
|
126
94
|
/>
|
|
@@ -128,9 +96,25 @@ function StackNavigator({
|
|
|
128
96
|
);
|
|
129
97
|
}
|
|
130
98
|
|
|
131
|
-
export
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
99
|
+
export function createStackNavigator<
|
|
100
|
+
const ParamList extends ParamListBase,
|
|
101
|
+
const NavigatorID extends string | undefined = string | undefined,
|
|
102
|
+
const TypeBag extends NavigatorTypeBagBase = {
|
|
103
|
+
ParamList: ParamList;
|
|
104
|
+
NavigatorID: NavigatorID;
|
|
105
|
+
State: StackNavigationState<ParamList>;
|
|
106
|
+
ScreenOptions: StackNavigationOptions;
|
|
107
|
+
EventMap: StackNavigationEventMap;
|
|
108
|
+
NavigationList: {
|
|
109
|
+
[RouteName in keyof ParamList]: StackNavigationProp<
|
|
110
|
+
ParamList,
|
|
111
|
+
RouteName,
|
|
112
|
+
NavigatorID
|
|
113
|
+
>;
|
|
114
|
+
};
|
|
115
|
+
Navigator: typeof StackNavigator;
|
|
116
|
+
},
|
|
117
|
+
const Config extends StaticConfig<TypeBag> = StaticConfig<TypeBag>,
|
|
118
|
+
>(config?: Config): TypedNavigator<TypeBag, Config> {
|
|
119
|
+
return createNavigatorFactory(StackNavigator)(config);
|
|
120
|
+
}
|