@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
package/src/types.tsx
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
HeaderBackButton,
|
|
3
|
+
HeaderBackButtonDisplayMode,
|
|
3
4
|
HeaderBackButtonProps,
|
|
4
|
-
HeaderButtonProps,
|
|
5
5
|
HeaderOptions,
|
|
6
6
|
HeaderTitleProps,
|
|
7
7
|
} from '@amazon-devices/react-navigation__elements';
|
|
8
8
|
import type {
|
|
9
|
+
DefaultNavigatorOptions,
|
|
9
10
|
Descriptor,
|
|
11
|
+
LocaleDirection,
|
|
10
12
|
NavigationHelpers,
|
|
11
13
|
NavigationProp,
|
|
12
14
|
ParamListBase,
|
|
@@ -14,6 +16,8 @@ import type {
|
|
|
14
16
|
RouteProp,
|
|
15
17
|
StackActionHelpers,
|
|
16
18
|
StackNavigationState,
|
|
19
|
+
StackRouterOptions,
|
|
20
|
+
Theme,
|
|
17
21
|
} from '@amazon-devices/react-navigation__native';
|
|
18
22
|
import type * as React from 'react';
|
|
19
23
|
import type { Animated, StyleProp, TextStyle, ViewStyle } from 'react-native';
|
|
@@ -50,7 +54,7 @@ export type StackNavigationHelpers = NavigationHelpers<
|
|
|
50
54
|
export type StackNavigationProp<
|
|
51
55
|
ParamList extends ParamListBase,
|
|
52
56
|
RouteName extends keyof ParamList = keyof ParamList,
|
|
53
|
-
NavigatorID extends string | undefined = undefined
|
|
57
|
+
NavigatorID extends string | undefined = undefined,
|
|
54
58
|
> = NavigationProp<
|
|
55
59
|
ParamList,
|
|
56
60
|
RouteName,
|
|
@@ -64,12 +68,20 @@ export type StackNavigationProp<
|
|
|
64
68
|
export type StackScreenProps<
|
|
65
69
|
ParamList extends ParamListBase,
|
|
66
70
|
RouteName extends keyof ParamList = keyof ParamList,
|
|
67
|
-
NavigatorID extends string | undefined = undefined
|
|
71
|
+
NavigatorID extends string | undefined = undefined,
|
|
68
72
|
> = {
|
|
69
73
|
navigation: StackNavigationProp<ParamList, RouteName, NavigatorID>;
|
|
70
74
|
route: RouteProp<ParamList, RouteName>;
|
|
71
75
|
};
|
|
72
76
|
|
|
77
|
+
export type StackOptionsArgs<
|
|
78
|
+
ParamList extends ParamListBase,
|
|
79
|
+
RouteName extends keyof ParamList = keyof ParamList,
|
|
80
|
+
NavigatorID extends string | undefined = undefined,
|
|
81
|
+
> = StackScreenProps<ParamList, RouteName, NavigatorID> & {
|
|
82
|
+
theme: Theme;
|
|
83
|
+
};
|
|
84
|
+
|
|
73
85
|
export type Layout = { width: number; height: number };
|
|
74
86
|
|
|
75
87
|
export type GestureDirection =
|
|
@@ -78,8 +90,20 @@ export type GestureDirection =
|
|
|
78
90
|
| 'vertical'
|
|
79
91
|
| 'vertical-inverted';
|
|
80
92
|
|
|
93
|
+
export type StackAnimationName =
|
|
94
|
+
| 'default'
|
|
95
|
+
| 'fade'
|
|
96
|
+
| 'fade_from_bottom'
|
|
97
|
+
| 'fade_from_right'
|
|
98
|
+
| 'none'
|
|
99
|
+
| 'reveal_from_bottom'
|
|
100
|
+
| 'scale_from_center'
|
|
101
|
+
| 'slide_from_bottom'
|
|
102
|
+
| 'slide_from_right'
|
|
103
|
+
| 'slide_from_left';
|
|
104
|
+
|
|
81
105
|
type SceneOptionsDefaults = TransitionPreset & {
|
|
82
|
-
|
|
106
|
+
animation: StackAnimationName;
|
|
83
107
|
gestureEnabled: boolean;
|
|
84
108
|
cardOverlayEnabled: boolean;
|
|
85
109
|
headerMode: StackHeaderMode;
|
|
@@ -139,11 +163,11 @@ export type StackHeaderOptions = Omit<
|
|
|
139
163
|
/**
|
|
140
164
|
* Function which returns a React Element to display on the left side of the header.
|
|
141
165
|
*/
|
|
142
|
-
headerLeft?: (props:
|
|
166
|
+
headerLeft?: (props: StackHeaderLeftProps) => React.ReactNode;
|
|
143
167
|
/**
|
|
144
168
|
* Function which returns a React Element to display on the right side of the header.
|
|
145
169
|
*/
|
|
146
|
-
headerRight?: (props:
|
|
170
|
+
headerRight?: (props: StackHeaderRightProps) => React.ReactNode;
|
|
147
171
|
/**
|
|
148
172
|
* Whether back button title font should scale to respect Text Size accessibility settings. Defaults to `false`.
|
|
149
173
|
*/
|
|
@@ -159,23 +183,31 @@ export type StackHeaderOptions = Omit<
|
|
|
159
183
|
/**
|
|
160
184
|
* Title string used by the back button on iOS.
|
|
161
185
|
* Defaults to the previous screen's title, or "Back" if there's not enough space.
|
|
162
|
-
* Use `
|
|
186
|
+
* Use `headerBackButtonDisplayMode` to customize the behavior.
|
|
163
187
|
*/
|
|
164
188
|
headerBackTitle?: string;
|
|
165
189
|
/**
|
|
166
|
-
*
|
|
190
|
+
* Title string used by the back button when `headerBackTitle` doesn't fit on the screen.
|
|
191
|
+
* Use `headerBackButtonDisplayMode` to customize the behavior.
|
|
167
192
|
*
|
|
168
|
-
* Defaults to
|
|
193
|
+
* Defaults to "Back".
|
|
169
194
|
*/
|
|
170
|
-
|
|
195
|
+
headerBackTruncatedTitle?: string;
|
|
171
196
|
/**
|
|
172
|
-
*
|
|
197
|
+
* How the back button displays icon and title.
|
|
198
|
+
*
|
|
199
|
+
* Supported values:
|
|
200
|
+
* - "default" - Displays one of the following depending on the available space: previous screen's title, truncated title (e.g. 'Back') or no title (only icon).
|
|
201
|
+
* - "generic" – Displays one of the following depending on the available space: truncated title (e.g. 'Back') or no title (only icon).
|
|
202
|
+
* - "minimal" – Always displays only the icon without a title.
|
|
203
|
+
*
|
|
204
|
+
* Defaults to "default" on iOS, and "minimal" on other platforms.
|
|
173
205
|
*/
|
|
174
|
-
|
|
206
|
+
headerBackButtonDisplayMode?: HeaderBackButtonDisplayMode;
|
|
175
207
|
/**
|
|
176
|
-
*
|
|
208
|
+
* Style object for the back title.
|
|
177
209
|
*/
|
|
178
|
-
|
|
210
|
+
headerBackTitleStyle?: StyleProp<TextStyle>;
|
|
179
211
|
/**
|
|
180
212
|
* Function which returns a React Element to display custom image in header's back button.
|
|
181
213
|
* It receives the `tintColor` in in the options object as an argument. object.
|
|
@@ -196,7 +228,11 @@ export type StackHeaderProps = {
|
|
|
196
228
|
/**
|
|
197
229
|
* Title of the previous screen.
|
|
198
230
|
*/
|
|
199
|
-
title: string;
|
|
231
|
+
title: string | undefined;
|
|
232
|
+
/**
|
|
233
|
+
* The `href` to use for the anchor tag on web
|
|
234
|
+
*/
|
|
235
|
+
href: string | undefined;
|
|
200
236
|
};
|
|
201
237
|
/**
|
|
202
238
|
* Animated nodes representing the progress of the animation.
|
|
@@ -220,6 +256,32 @@ export type StackHeaderProps = {
|
|
|
220
256
|
styleInterpolator: StackHeaderStyleInterpolator;
|
|
221
257
|
};
|
|
222
258
|
|
|
259
|
+
export type StackHeaderRightProps = {
|
|
260
|
+
/**
|
|
261
|
+
* Tint color for the header button.
|
|
262
|
+
*/
|
|
263
|
+
tintColor?: string;
|
|
264
|
+
/**
|
|
265
|
+
* Color for material ripple (Android >= 5.0 only).
|
|
266
|
+
*/
|
|
267
|
+
pressColor?: string;
|
|
268
|
+
/**
|
|
269
|
+
* Opacity when the button is pressed, used when ripple is not supported.
|
|
270
|
+
*/
|
|
271
|
+
pressOpacity?: number;
|
|
272
|
+
/**
|
|
273
|
+
* Whether it's possible to navigate back in stack.
|
|
274
|
+
*/
|
|
275
|
+
canGoBack?: boolean;
|
|
276
|
+
};
|
|
277
|
+
|
|
278
|
+
export type StackHeaderLeftProps = HeaderBackButtonProps & {
|
|
279
|
+
/**
|
|
280
|
+
* Whether it's possible to navigate back in stack.
|
|
281
|
+
*/
|
|
282
|
+
canGoBack?: boolean;
|
|
283
|
+
};
|
|
284
|
+
|
|
223
285
|
export type StackDescriptor = Descriptor<
|
|
224
286
|
StackNavigationOptions,
|
|
225
287
|
StackNavigationProp<ParamListBase>,
|
|
@@ -296,11 +358,20 @@ export type StackNavigationOptions = StackHeaderOptions &
|
|
|
296
358
|
*/
|
|
297
359
|
presentation?: 'card' | 'modal' | 'transparentModal';
|
|
298
360
|
/**
|
|
299
|
-
*
|
|
300
|
-
*
|
|
301
|
-
*
|
|
361
|
+
* How the screen should animate when pushed or popped.
|
|
362
|
+
*
|
|
363
|
+
* Supported values:
|
|
364
|
+
* - 'none': don't animate the screen
|
|
365
|
+
* - 'default': use the platform default animation
|
|
366
|
+
* - 'fade': fade screen in or out
|
|
367
|
+
* - 'fade_from_bottom': fade screen in or out from bottom
|
|
368
|
+
* - 'slide_from_bottom': slide in the new screen from bottom
|
|
369
|
+
* - 'slide_from_right': slide in the new screen from right
|
|
370
|
+
* - 'slide_from_left': slide in the new screen from left
|
|
371
|
+
* - 'reveal_from_bottom': reveal screen in from bottom to top
|
|
372
|
+
* - 'scale_from_center': scale screen in from center
|
|
302
373
|
*/
|
|
303
|
-
|
|
374
|
+
animation?: StackAnimationName;
|
|
304
375
|
/**
|
|
305
376
|
* The type of animation to use when this screen replaces another screen. Defaults to `push`.
|
|
306
377
|
* When `pop` is used, the `pop` animation is applied to the screen being replaced.
|
|
@@ -341,6 +412,12 @@ export type StackNavigationOptions = StackHeaderOptions &
|
|
|
341
412
|
* Only supported on iOS and Android.
|
|
342
413
|
*/
|
|
343
414
|
freezeOnBlur?: boolean;
|
|
415
|
+
/**
|
|
416
|
+
* Whether the home indicator should prefer to stay hidden on this screen. Defaults to `false`.
|
|
417
|
+
*
|
|
418
|
+
* @platform ios
|
|
419
|
+
*/
|
|
420
|
+
autoHideHomeIndicator?: boolean;
|
|
344
421
|
};
|
|
345
422
|
|
|
346
423
|
export type StackNavigationConfig = {
|
|
@@ -404,7 +481,7 @@ export type StackCardInterpolationProps = {
|
|
|
404
481
|
/**
|
|
405
482
|
* Animated node representing multiplier when direction is inverted (-1 - inverted, 1 - normal).
|
|
406
483
|
*/
|
|
407
|
-
inverted: Animated.AnimatedInterpolation
|
|
484
|
+
inverted: Animated.AnimatedInterpolation<1 | -1>;
|
|
408
485
|
/**
|
|
409
486
|
* Layout measurements for various items we use for animation.
|
|
410
487
|
*/
|
|
@@ -429,19 +506,19 @@ export type StackCardInterpolatedStyle = {
|
|
|
429
506
|
/**
|
|
430
507
|
* Interpolated style for the container view wrapping the card.
|
|
431
508
|
*/
|
|
432
|
-
containerStyle?:
|
|
509
|
+
containerStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
433
510
|
/**
|
|
434
511
|
* Interpolated style for the view representing the card.
|
|
435
512
|
*/
|
|
436
|
-
cardStyle?:
|
|
513
|
+
cardStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
437
514
|
/**
|
|
438
515
|
* Interpolated style for the view representing the semi-transparent overlay below the card.
|
|
439
516
|
*/
|
|
440
|
-
overlayStyle?:
|
|
517
|
+
overlayStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
441
518
|
/**
|
|
442
519
|
* Interpolated style representing the card shadow.
|
|
443
520
|
*/
|
|
444
|
-
shadowStyle?:
|
|
521
|
+
shadowStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
445
522
|
};
|
|
446
523
|
|
|
447
524
|
export type StackCardStyleInterpolator = (
|
|
@@ -468,6 +545,10 @@ export type StackHeaderInterpolationProps = {
|
|
|
468
545
|
*/
|
|
469
546
|
progress: Animated.AnimatedInterpolation<number>;
|
|
470
547
|
};
|
|
548
|
+
/**
|
|
549
|
+
* Writing direction of the layout.
|
|
550
|
+
*/
|
|
551
|
+
direction: LocaleDirection;
|
|
471
552
|
/**
|
|
472
553
|
* Layout measurements for various items we use for animation.
|
|
473
554
|
*/
|
|
@@ -545,3 +626,14 @@ export type TransitionPreset = {
|
|
|
545
626
|
*/
|
|
546
627
|
headerStyleInterpolator: StackHeaderStyleInterpolator;
|
|
547
628
|
};
|
|
629
|
+
|
|
630
|
+
export type StackNavigatorProps = DefaultNavigatorOptions<
|
|
631
|
+
ParamListBase,
|
|
632
|
+
string | undefined,
|
|
633
|
+
StackNavigationState<ParamListBase>,
|
|
634
|
+
StackNavigationOptions,
|
|
635
|
+
StackNavigationEventMap,
|
|
636
|
+
StackNavigationProp<ParamListBase>
|
|
637
|
+
> &
|
|
638
|
+
StackRouterOptions &
|
|
639
|
+
StackNavigationConfig;
|
|
@@ -2,6 +2,6 @@ import * as React from 'react';
|
|
|
2
2
|
|
|
3
3
|
import type { StackCardInterpolationProps } from '../types';
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
undefined
|
|
7
|
-
);
|
|
5
|
+
export const CardAnimationContext = React.createContext<
|
|
6
|
+
StackCardInterpolationProps | undefined
|
|
7
|
+
>(undefined);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
import('react-native-gesture-handler').PanGestureHandler
|
|
3
|
+
export const GestureHandlerRefContext = React.createContext<React.Ref<
|
|
4
|
+
import('@amazon-devices/react-native-gesture-handler').PanGestureHandler
|
|
5
5
|
> | null>(null);
|
|
@@ -9,7 +9,7 @@ const { add, multiply } = Animated;
|
|
|
9
9
|
* @param main Animated Node to use if the condition is `true`
|
|
10
10
|
* @param fallback Animated Node to use if the condition is `false`
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
12
|
+
export function conditional(
|
|
13
13
|
condition: Animated.AnimatedInterpolation<0 | 1>,
|
|
14
14
|
main: Animated.AnimatedInterpolation<number>,
|
|
15
15
|
fallback: Animated.AnimatedInterpolation<number>
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
export
|
|
2
|
-
array
|
|
3
|
-
callback: (value: T) => boolean
|
|
4
|
-
) {
|
|
5
|
-
for (var i = array.length - 1; i >= 0; i--) {
|
|
1
|
+
export function findLastIndex<T>(array: T[], callback: (value: T) => boolean) {
|
|
2
|
+
for (let i = array.length - 1; i >= 0; i--) {
|
|
6
3
|
if (callback(array[i])) {
|
|
7
4
|
return i;
|
|
8
5
|
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { LocaleDirection } from '@amazon-devices/react-navigation__native';
|
|
2
|
+
|
|
3
|
+
import type { GestureDirection, Layout } from '../types';
|
|
4
|
+
import { getInvertedMultiplier } from './getInvertedMultiplier';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The distance of touch start from the edge of the screen where the gesture will be recognized
|
|
8
|
+
*/
|
|
9
|
+
const GESTURE_RESPONSE_DISTANCE_HORIZONTAL = 50;
|
|
10
|
+
const GESTURE_RESPONSE_DISTANCE_VERTICAL = 135;
|
|
11
|
+
|
|
12
|
+
export const gestureActivationCriteria = ({
|
|
13
|
+
direction,
|
|
14
|
+
gestureDirection,
|
|
15
|
+
gestureResponseDistance,
|
|
16
|
+
layout,
|
|
17
|
+
}: {
|
|
18
|
+
direction: LocaleDirection;
|
|
19
|
+
gestureDirection: GestureDirection;
|
|
20
|
+
gestureResponseDistance?: number;
|
|
21
|
+
layout: Layout;
|
|
22
|
+
}) => {
|
|
23
|
+
const enableTrackpadTwoFingerGesture = true;
|
|
24
|
+
|
|
25
|
+
const distance =
|
|
26
|
+
gestureResponseDistance !== undefined
|
|
27
|
+
? gestureResponseDistance
|
|
28
|
+
: gestureDirection === 'vertical' ||
|
|
29
|
+
gestureDirection === 'vertical-inverted'
|
|
30
|
+
? GESTURE_RESPONSE_DISTANCE_VERTICAL
|
|
31
|
+
: GESTURE_RESPONSE_DISTANCE_HORIZONTAL;
|
|
32
|
+
|
|
33
|
+
if (gestureDirection === 'vertical') {
|
|
34
|
+
return {
|
|
35
|
+
maxDeltaX: 15,
|
|
36
|
+
minOffsetY: 5,
|
|
37
|
+
hitSlop: { bottom: -layout.height + distance },
|
|
38
|
+
enableTrackpadTwoFingerGesture,
|
|
39
|
+
};
|
|
40
|
+
} else if (gestureDirection === 'vertical-inverted') {
|
|
41
|
+
return {
|
|
42
|
+
maxDeltaX: 15,
|
|
43
|
+
minOffsetY: -5,
|
|
44
|
+
hitSlop: { top: -layout.height + distance },
|
|
45
|
+
enableTrackpadTwoFingerGesture,
|
|
46
|
+
};
|
|
47
|
+
} else {
|
|
48
|
+
const hitSlop = -layout.width + distance;
|
|
49
|
+
const invertedMultiplier = getInvertedMultiplier(
|
|
50
|
+
gestureDirection,
|
|
51
|
+
direction === 'rtl'
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
if (invertedMultiplier === 1) {
|
|
55
|
+
return {
|
|
56
|
+
minOffsetX: 5,
|
|
57
|
+
maxDeltaY: 20,
|
|
58
|
+
hitSlop: { right: hitSlop },
|
|
59
|
+
enableTrackpadTwoFingerGesture,
|
|
60
|
+
};
|
|
61
|
+
} else {
|
|
62
|
+
return {
|
|
63
|
+
minOffsetX: -5,
|
|
64
|
+
maxDeltaY: 20,
|
|
65
|
+
hitSlop: { left: hitSlop },
|
|
66
|
+
enableTrackpadTwoFingerGesture,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
};
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import type { GestureDirection, Layout } from '../types';
|
|
2
|
-
import getInvertedMultiplier from './getInvertedMultiplier';
|
|
2
|
+
import { getInvertedMultiplier } from './getInvertedMultiplier';
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export function getDistanceForDirection(
|
|
5
5
|
layout: Layout,
|
|
6
|
-
gestureDirection: GestureDirection
|
|
6
|
+
gestureDirection: GestureDirection,
|
|
7
|
+
isRTL: boolean
|
|
7
8
|
): number {
|
|
8
|
-
const multiplier = getInvertedMultiplier(gestureDirection);
|
|
9
|
+
const multiplier = getInvertedMultiplier(gestureDirection, isRTL);
|
|
9
10
|
|
|
10
11
|
switch (gestureDirection) {
|
|
11
12
|
case 'vertical':
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import { I18nManager } from 'react-native';
|
|
2
|
-
|
|
3
1
|
import type { GestureDirection } from '../types';
|
|
4
2
|
|
|
5
|
-
export
|
|
6
|
-
gestureDirection: GestureDirection
|
|
3
|
+
export function getInvertedMultiplier(
|
|
4
|
+
gestureDirection: GestureDirection,
|
|
5
|
+
isRTL: boolean
|
|
7
6
|
): 1 | -1 {
|
|
8
7
|
switch (gestureDirection) {
|
|
9
8
|
case 'vertical':
|
|
@@ -11,8 +10,8 @@ export default function getInvertedMultiplier(
|
|
|
11
10
|
case 'vertical-inverted':
|
|
12
11
|
return -1;
|
|
13
12
|
case 'horizontal':
|
|
14
|
-
return
|
|
13
|
+
return isRTL ? -1 : 1;
|
|
15
14
|
case 'horizontal-inverted':
|
|
16
|
-
return
|
|
15
|
+
return isRTL ? 1 : -1;
|
|
17
16
|
}
|
|
18
17
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Route } from '@amazon-devices/react-navigation__native';
|
|
2
|
+
|
|
3
|
+
import type { StackDescriptorMap } from '../types';
|
|
4
|
+
|
|
5
|
+
export const getModalRouteKeys = (
|
|
6
|
+
routes: Route<string>[],
|
|
7
|
+
descriptors: StackDescriptorMap
|
|
8
|
+
) =>
|
|
9
|
+
routes.reduce<string[]>((acc, route) => {
|
|
10
|
+
const { presentation } = descriptors[route.key]?.options ?? {};
|
|
11
|
+
|
|
12
|
+
if (
|
|
13
|
+
(acc.length && !presentation) ||
|
|
14
|
+
presentation === 'modal' ||
|
|
15
|
+
presentation === 'transparentModal'
|
|
16
|
+
) {
|
|
17
|
+
acc.push(route.key);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return acc;
|
|
21
|
+
}, []);
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import Color from 'color';
|
|
2
|
+
import { Platform } from 'react-native';
|
|
3
|
+
|
|
4
|
+
type ShadowConfig = {
|
|
5
|
+
offset: {
|
|
6
|
+
width: number;
|
|
7
|
+
height: number;
|
|
8
|
+
};
|
|
9
|
+
radius: number;
|
|
10
|
+
opacity: number;
|
|
11
|
+
color?: string;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export function getShadowStyle({
|
|
15
|
+
offset,
|
|
16
|
+
radius,
|
|
17
|
+
opacity,
|
|
18
|
+
color = '#000',
|
|
19
|
+
}: ShadowConfig) {
|
|
20
|
+
const result = Platform.select({
|
|
21
|
+
web: {
|
|
22
|
+
boxShadow: `${offset.width}px ${offset.height}px ${radius}px ${Color(
|
|
23
|
+
color
|
|
24
|
+
)
|
|
25
|
+
.alpha(opacity)
|
|
26
|
+
.toString()}`,
|
|
27
|
+
},
|
|
28
|
+
default: {
|
|
29
|
+
shadowOffset: offset,
|
|
30
|
+
shadowRadius: radius,
|
|
31
|
+
shadowColor: color,
|
|
32
|
+
shadowOpacity: opacity,
|
|
33
|
+
},
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
return result;
|
|
37
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export function throttle<T extends (...args: any[]) => void>(
|
|
2
|
+
func: T,
|
|
3
|
+
duration: number
|
|
4
|
+
): T {
|
|
5
|
+
let timeout: ReturnType<typeof setTimeout> | undefined;
|
|
6
|
+
|
|
7
|
+
return function (this: unknown, ...args) {
|
|
8
|
+
if (timeout == null) {
|
|
9
|
+
func.apply(this, args);
|
|
10
|
+
|
|
11
|
+
timeout = setTimeout(() => {
|
|
12
|
+
timeout = undefined;
|
|
13
|
+
}, duration);
|
|
14
|
+
}
|
|
15
|
+
} as T;
|
|
16
|
+
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import CardAnimationContext from './CardAnimationContext';
|
|
3
|
+
import { CardAnimationContext } from './CardAnimationContext';
|
|
4
4
|
|
|
5
|
-
export
|
|
5
|
+
export function useCardAnimation() {
|
|
6
6
|
const animation = React.useContext(CardAnimationContext);
|
|
7
7
|
|
|
8
8
|
if (animation === undefined) {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
|
|
3
|
-
import
|
|
3
|
+
import { GestureHandlerRefContext } from './GestureHandlerRefContext';
|
|
4
4
|
|
|
5
|
-
export
|
|
6
|
-
const ref = React.useContext(
|
|
5
|
+
export function useGestureHandlerRef() {
|
|
6
|
+
const ref = React.useContext(GestureHandlerRefContext);
|
|
7
7
|
|
|
8
8
|
if (ref === undefined) {
|
|
9
9
|
throw new Error(
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { type HostInstance, Keyboard, TextInput } from 'react-native';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export default function useKeyboardManager(isEnabled: () => boolean) {
|
|
4
|
+
export function useKeyboardManager(isEnabled: () => boolean) {
|
|
7
5
|
// Numeric id of the previously focused text input
|
|
8
6
|
// When a gesture didn't change the tab, we can restore the focused input with this
|
|
9
|
-
const previouslyFocusedTextInputRef = React.useRef<
|
|
7
|
+
const previouslyFocusedTextInputRef = React.useRef<HostInstance>(undefined);
|
|
10
8
|
const startTimestampRef = React.useRef<number>(0);
|
|
11
|
-
const keyboardTimeoutRef = React.useRef<
|
|
9
|
+
const keyboardTimeoutRef = React.useRef<NodeJS.Timeout>(undefined);
|
|
12
10
|
|
|
13
11
|
const clearKeyboardTimeout = React.useCallback(() => {
|
|
14
12
|
if (keyboardTimeoutRef.current !== undefined) {
|
|
@@ -24,7 +22,7 @@ export default function useKeyboardManager(isEnabled: () => boolean) {
|
|
|
24
22
|
|
|
25
23
|
clearKeyboardTimeout();
|
|
26
24
|
|
|
27
|
-
const input
|
|
25
|
+
const input = TextInput.State.currentlyFocusedInput();
|
|
28
26
|
|
|
29
27
|
// When a page change begins, blur the currently focused input
|
|
30
28
|
input?.blur();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './GestureHandlerNative';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { View } from 'react-native';
|
|
3
|
-
import type { PanGestureHandlerProperties } from 'react-native-gesture-handler';
|
|
3
|
+
import type { PanGestureHandlerProperties } from '@amazon-devices/react-native-gesture-handler';
|
|
4
4
|
|
|
5
5
|
const Dummy: any = ({ children }: { children: React.ReactNode }) => (
|
|
6
6
|
<>{children}</>
|
|
@@ -20,4 +20,4 @@ export const GestureState = {
|
|
|
20
20
|
END: 5,
|
|
21
21
|
};
|
|
22
22
|
|
|
23
|
-
export type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';
|
|
23
|
+
export type { PanGestureHandlerGestureEvent } from '@amazon-devices/react-native-gesture-handler';
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import {
|
|
3
3
|
PanGestureHandler as PanGestureHandlerNative,
|
|
4
|
-
PanGestureHandlerProperties,
|
|
5
|
-
} from 'react-native-gesture-handler';
|
|
4
|
+
type PanGestureHandlerProperties,
|
|
5
|
+
} from '@amazon-devices/react-native-gesture-handler';
|
|
6
6
|
|
|
7
|
-
import GestureHandlerRefContext from '../utils/GestureHandlerRefContext';
|
|
7
|
+
import { GestureHandlerRefContext } from '../utils/GestureHandlerRefContext';
|
|
8
8
|
|
|
9
9
|
export function PanGestureHandler(props: PanGestureHandlerProperties) {
|
|
10
10
|
const gestureRef = React.useRef<PanGestureHandlerNative>(null);
|
|
@@ -16,8 +16,8 @@ export function PanGestureHandler(props: PanGestureHandlerProperties) {
|
|
|
16
16
|
);
|
|
17
17
|
}
|
|
18
18
|
|
|
19
|
-
export type { PanGestureHandlerGestureEvent } from 'react-native-gesture-handler';
|
|
19
|
+
export type { PanGestureHandlerGestureEvent } from '@amazon-devices/react-native-gesture-handler';
|
|
20
20
|
export {
|
|
21
21
|
GestureHandlerRootView,
|
|
22
22
|
State as GestureState,
|
|
23
|
-
} from 'react-native-gesture-handler';
|
|
23
|
+
} from '@amazon-devices/react-native-gesture-handler';
|
|
@@ -4,11 +4,11 @@ import * as React from 'react';
|
|
|
4
4
|
import { useSafeAreaInsets } from '@amazon-devices/react-native-safe-area-context';
|
|
5
5
|
|
|
6
6
|
import type { StackHeaderProps } from '../../types';
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import HeaderSegment from './HeaderSegment';
|
|
7
|
+
import { ModalPresentationContext } from '../../utils/ModalPresentationContext';
|
|
8
|
+
import { throttle } from '../../utils/throttle';
|
|
9
|
+
import { HeaderSegment } from './HeaderSegment';
|
|
10
10
|
|
|
11
|
-
export
|
|
11
|
+
export const Header = React.memo(function Header({
|
|
12
12
|
back,
|
|
13
13
|
layout,
|
|
14
14
|
progress,
|
|
@@ -31,7 +31,7 @@ export default React.memo(function Header({
|
|
|
31
31
|
|
|
32
32
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
33
33
|
const goBack = React.useCallback(
|
|
34
|
-
|
|
34
|
+
throttle(() => {
|
|
35
35
|
if (navigation.isFocused() && navigation.canGoBack()) {
|
|
36
36
|
navigation.dispatch({
|
|
37
37
|
...StackActions.pop(),
|
|
@@ -49,8 +49,8 @@ export default React.memo(function Header({
|
|
|
49
49
|
options.headerStatusBarHeight !== undefined
|
|
50
50
|
? options.headerStatusBarHeight
|
|
51
51
|
: isModal || isParentHeaderShown
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
? 0
|
|
53
|
+
: insets.top;
|
|
54
54
|
|
|
55
55
|
return (
|
|
56
56
|
<HeaderSegment
|
|
@@ -66,6 +66,7 @@ export default React.memo(function Header({
|
|
|
66
66
|
}
|
|
67
67
|
headerStatusBarHeight={statusBarHeight}
|
|
68
68
|
onGoBack={back ? goBack : undefined}
|
|
69
|
+
backHref={back ? back.href : undefined}
|
|
69
70
|
styleInterpolator={styleInterpolator}
|
|
70
71
|
/>
|
|
71
72
|
);
|