@amazon-devices/react-native-screens 3.0.9000000000 → 3.0.9000000003
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SystemModules/amzn__react-native-screens-3.private.modules.txt +116 -61
- package/kepler-compatibility.json +5 -2
- package/lib/commonjs/TransitionProgressContext.js.map +1 -1
- package/lib/commonjs/components/DebugContainer.js.map +1 -1
- package/lib/commonjs/components/DebugContainer.web.js.map +1 -1
- package/lib/commonjs/components/Screen.web.js.map +1 -1
- package/lib/commonjs/components/ScreenStackHeaderConfig.js.map +1 -1
- package/lib/commonjs/components/ScreenStackHeaderConfig.web.js.map +1 -1
- package/lib/commonjs/components/ScreenStackItem.js.map +1 -1
- package/lib/commonjs/components/SearchBar.js.map +1 -1
- package/lib/commonjs/components/helpers/usePrevious.js.map +1 -1
- package/lib/commonjs/gesture-handler/ScreenGestureDetector.js.map +1 -1
- package/lib/commonjs/index.js +0 -210
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js.map +1 -1
- package/lib/commonjs/native-stack/utils/AnimatedHeaderHeightContext.js.map +1 -1
- package/lib/commonjs/native-stack/utils/HeaderHeightContext.js.map +1 -1
- package/lib/commonjs/native-stack/utils/SafeAreaProviderCompat.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useAnimatedHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useBackPressSubscription.js.map +1 -1
- package/lib/commonjs/native-stack/utils/useHeaderHeight.js.map +1 -1
- package/lib/commonjs/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/commonjs/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedHeaderHeightContext.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js.map +1 -1
- package/lib/commonjs/reanimated/ReanimatedTransitionProgressContext.js.map +1 -1
- package/lib/commonjs/reanimated/useReanimatedHeaderHeight.js.map +1 -1
- package/lib/commonjs/reanimated/useReanimatedTransitionProgress.js.map +1 -1
- package/lib/commonjs/useTransitionProgress.js.map +1 -1
- package/lib/module/components/Screen.web.js.map +1 -1
- package/lib/module/components/ScreenStackHeaderConfig.js.map +1 -1
- package/lib/module/components/ScreenStackHeaderConfig.web.js.map +1 -1
- package/lib/module/components/SearchBar.js.map +1 -1
- package/lib/module/components/helpers/usePrevious.js.map +1 -1
- package/lib/module/native-stack/utils/useBackPressSubscription.js.map +1 -1
- package/lib/module/native-stack/views/HeaderConfig.js.map +1 -1
- package/lib/module/native-stack/views/NativeStackView.js.map +1 -1
- package/lib/typescript/components/Screen.web.d.ts +1 -1
- package/lib/typescript/components/Screen.web.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStackHeaderConfig.d.ts +5 -5
- package/lib/typescript/components/ScreenStackHeaderConfig.d.ts.map +1 -1
- package/lib/typescript/components/ScreenStackHeaderConfig.web.d.ts +6 -6
- package/lib/typescript/components/ScreenStackHeaderConfig.web.d.ts.map +1 -1
- package/lib/typescript/components/SearchBar.d.ts.map +1 -1
- package/lib/typescript/components/helpers/usePrevious.d.ts.map +1 -1
- package/lib/typescript/native-stack/utils/useBackPressSubscription.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/HeaderConfig.d.ts +2 -2
- package/lib/typescript/native-stack/views/HeaderConfig.d.ts.map +1 -1
- package/lib/typescript/native-stack/views/NativeStackView.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +2 -2
- package/lib/typescript/types.d.ts.map +1 -1
- package/oss-attribution/attribution.txt +77 -0
- package/oss-attribution/licenseInfos.json +27 -0
- package/package.json +1 -1
- package/src/index.tsx +0 -55
- package/SystemBundles/31d5b6b69618249f6233b73a1de7c4d890c86be7ccb031ce7cf2dcc41783f9f7.bundle +0 -45301
- package/SystemBundles/31d5b6b69618249f6233b73a1de7c4d890c86be7ccb031ce7cf2dcc41783f9f7.map +0 -13711
- package/lib/commonjs/TransitionProgressContext.js +0 -12
- package/lib/commonjs/components/DebugContainer.js +0 -39
- package/lib/commonjs/components/DebugContainer.web.js +0 -15
- package/lib/commonjs/components/FullWindowOverlay.js +0 -31
- package/lib/commonjs/components/FullWindowOverlay.web.js +0 -9
- package/lib/commonjs/components/Screen.js +0 -286
- package/lib/commonjs/components/Screen.web.js +0 -47
- package/lib/commonjs/components/ScreenContainer.js +0 -32
- package/lib/commonjs/components/ScreenContainer.web.js +0 -10
- package/lib/commonjs/components/ScreenContentWrapper.js +0 -17
- package/lib/commonjs/components/ScreenContentWrapper.web.js +0 -10
- package/lib/commonjs/components/ScreenFooter.js +0 -25
- package/lib/commonjs/components/ScreenFooter.web.js +0 -11
- package/lib/commonjs/components/ScreenStack.js +0 -67
- package/lib/commonjs/components/ScreenStack.web.js +0 -10
- package/lib/commonjs/components/ScreenStackHeaderConfig.js +0 -90
- package/lib/commonjs/components/ScreenStackHeaderConfig.web.js +0 -27
- package/lib/commonjs/components/ScreenStackItem.js +0 -107
- package/lib/commonjs/components/SearchBar.js +0 -63
- package/lib/commonjs/components/SearchBar.web.js +0 -10
- package/lib/commonjs/components/helpers/DelayedFreeze.js +0 -31
- package/lib/commonjs/components/helpers/usePrevious.js +0 -15
- package/lib/commonjs/contexts.js +0 -11
- package/lib/commonjs/core.js +0 -40
- package/lib/commonjs/fabric/FullWindowOverlayNativeComponent.js +0 -26
- package/lib/commonjs/fabric/ModalScreenNativeComponent.js +0 -14
- package/lib/commonjs/fabric/NativeScreensModule.js +0 -10
- package/lib/commonjs/fabric/NativeScreensModule.web.js +0 -8
- package/lib/commonjs/fabric/ScreenContainerNativeComponent.js +0 -30
- package/lib/commonjs/fabric/ScreenContentWrapperNativeComponent.js +0 -18
- package/lib/commonjs/fabric/ScreenFooterNativeComponent.js +0 -10
- package/lib/commonjs/fabric/ScreenNativeComponent.js +0 -70
- package/lib/commonjs/fabric/ScreenNavigationContainerNativeComponent.js +0 -12
- package/lib/commonjs/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -32
- package/lib/commonjs/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -15
- package/lib/commonjs/fabric/ScreenStackNativeComponent.js +0 -32
- package/lib/commonjs/fabric/SearchBarNativeComponent.js +0 -18
- package/lib/commonjs/gesture-handler/GestureDetectorProvider.js +0 -19
- package/lib/commonjs/gesture-handler/RNScreensTurboModule.js +0 -8
- package/lib/commonjs/gesture-handler/ScreenGestureDetector.js +0 -201
- package/lib/commonjs/gesture-handler/constraints.js +0 -64
- package/lib/commonjs/gesture-handler/defaults.js +0 -45
- package/lib/commonjs/gesture-handler/fabricUtils.js +0 -66
- package/lib/commonjs/gesture-handler/fabricUtils.web.js +0 -17
- package/lib/commonjs/gesture-handler/index.js +0 -14
- package/lib/commonjs/native-stack/contexts/GHContext.js +0 -12
- package/lib/commonjs/native-stack/index.js +0 -49
- package/lib/commonjs/native-stack/navigators/createNativeStackNavigator.js +0 -76
- package/lib/commonjs/native-stack/types.js +0 -6
- package/lib/commonjs/native-stack/utils/AnimatedHeaderHeightContext.js +0 -12
- package/lib/commonjs/native-stack/utils/HeaderHeightContext.js +0 -12
- package/lib/commonjs/native-stack/utils/SafeAreaProviderCompat.js +0 -75
- package/lib/commonjs/native-stack/utils/getDefaultHeaderHeight.js +0 -35
- package/lib/commonjs/native-stack/utils/getStatusBarHeight.js +0 -22
- package/lib/commonjs/native-stack/utils/useAnimatedHeaderHeight.js +0 -19
- package/lib/commonjs/native-stack/utils/useBackPressSubscription.js +0 -52
- package/lib/commonjs/native-stack/utils/useHeaderHeight.js +0 -19
- package/lib/commonjs/native-stack/views/FontProcessor.js +0 -19
- package/lib/commonjs/native-stack/views/FooterComponent.js +0 -17
- package/lib/commonjs/native-stack/views/HeaderConfig.js +0 -149
- package/lib/commonjs/native-stack/views/NativeStackView.js +0 -420
- package/lib/commonjs/reanimated/ReanimatedHeaderHeightContext.js +0 -12
- package/lib/commonjs/reanimated/ReanimatedNativeStackScreen.js +0 -95
- package/lib/commonjs/reanimated/ReanimatedScreen.js +0 -22
- package/lib/commonjs/reanimated/ReanimatedScreenProvider.js +0 -39
- package/lib/commonjs/reanimated/ReanimatedTransitionProgressContext.js +0 -12
- package/lib/commonjs/reanimated/index.js +0 -28
- package/lib/commonjs/reanimated/useReanimatedHeaderHeight.js +0 -19
- package/lib/commonjs/reanimated/useReanimatedTransitionProgress.js +0 -19
- package/lib/commonjs/types.js +0 -6
- package/lib/commonjs/useTransitionProgress.js +0 -19
- package/lib/commonjs/utils.js +0 -43
- package/lib/module/TransitionProgressContext.js +0 -5
- package/lib/module/components/DebugContainer.js +0 -30
- package/lib/module/components/DebugContainer.web.js +0 -6
- package/lib/module/components/FullWindowOverlay.js +0 -24
- package/lib/module/components/FullWindowOverlay.web.js +0 -3
- package/lib/module/components/Screen.js +0 -282
- package/lib/module/components/Screen.web.js +0 -40
- package/lib/module/components/ScreenContainer.js +0 -26
- package/lib/module/components/ScreenContainer.web.js +0 -4
- package/lib/module/components/ScreenContentWrapper.js +0 -10
- package/lib/module/components/ScreenContentWrapper.web.js +0 -4
- package/lib/module/components/ScreenFooter.js +0 -18
- package/lib/module/components/ScreenFooter.web.js +0 -6
- package/lib/module/components/ScreenStack.js +0 -63
- package/lib/module/components/ScreenStack.web.js +0 -4
- package/lib/module/components/ScreenStackHeaderConfig.js +0 -81
- package/lib/module/components/ScreenStackHeaderConfig.web.js +0 -14
- package/lib/module/components/ScreenStackItem.js +0 -98
- package/lib/module/components/SearchBar.js +0 -57
- package/lib/module/components/SearchBar.web.js +0 -4
- package/lib/module/components/helpers/DelayedFreeze.js +0 -24
- package/lib/module/components/helpers/usePrevious.js +0 -9
- package/lib/module/contexts.js +0 -4
- package/lib/module/core.js +0 -31
- package/lib/module/fabric/FullWindowOverlayNativeComponent.js +0 -20
- package/lib/module/fabric/ModalScreenNativeComponent.js +0 -10
- package/lib/module/fabric/NativeScreensModule.js +0 -5
- package/lib/module/fabric/NativeScreensModule.web.js +0 -2
- package/lib/module/fabric/ScreenContainerNativeComponent.js +0 -24
- package/lib/module/fabric/ScreenContentWrapperNativeComponent.js +0 -10
- package/lib/module/fabric/ScreenFooterNativeComponent.js +0 -3
- package/lib/module/fabric/ScreenNativeComponent.js +0 -66
- package/lib/module/fabric/ScreenNavigationContainerNativeComponent.js +0 -6
- package/lib/module/fabric/ScreenStackHeaderConfigNativeComponent.js +0 -29
- package/lib/module/fabric/ScreenStackHeaderSubviewNativeComponent.js +0 -11
- package/lib/module/fabric/ScreenStackNativeComponent.js +0 -28
- package/lib/module/fabric/SearchBarNativeComponent.js +0 -12
- package/lib/module/gesture-handler/GestureDetectorProvider.js +0 -12
- package/lib/module/gesture-handler/RNScreensTurboModule.js +0 -2
- package/lib/module/gesture-handler/ScreenGestureDetector.js +0 -193
- package/lib/module/gesture-handler/constraints.js +0 -56
- package/lib/module/gesture-handler/defaults.js +0 -39
- package/lib/module/gesture-handler/fabricUtils.js +0 -61
- package/lib/module/gesture-handler/fabricUtils.web.js +0 -10
- package/lib/module/gesture-handler/index.js +0 -5
- package/lib/module/index.js +0 -33
- package/lib/module/native-stack/contexts/GHContext.js +0 -6
- package/lib/module/native-stack/index.js +0 -22
- package/lib/module/native-stack/navigators/createNativeStackNavigator.js +0 -73
- package/lib/module/native-stack/types.js +0 -2
- package/lib/module/native-stack/utils/AnimatedHeaderHeightContext.js +0 -4
- package/lib/module/native-stack/utils/HeaderHeightContext.js +0 -4
- package/lib/module/native-stack/utils/SafeAreaProviderCompat.js +0 -68
- package/lib/module/native-stack/utils/getDefaultHeaderHeight.js +0 -29
- package/lib/module/native-stack/utils/getStatusBarHeight.js +0 -16
- package/lib/module/native-stack/utils/useAnimatedHeaderHeight.js +0 -10
- package/lib/module/native-stack/utils/useBackPressSubscription.js +0 -45
- package/lib/module/native-stack/utils/useHeaderHeight.js +0 -10
- package/lib/module/native-stack/views/FontProcessor.js +0 -12
- package/lib/module/native-stack/views/FooterComponent.js +0 -10
- package/lib/module/native-stack/views/HeaderConfig.js +0 -139
- package/lib/module/native-stack/views/NativeStackView.js +0 -423
- package/lib/module/reanimated/ReanimatedHeaderHeightContext.js +0 -5
- package/lib/module/reanimated/ReanimatedNativeStackScreen.js +0 -93
- package/lib/module/reanimated/ReanimatedScreen.js +0 -16
- package/lib/module/reanimated/ReanimatedScreenProvider.js +0 -32
- package/lib/module/reanimated/ReanimatedTransitionProgressContext.js +0 -5
- package/lib/module/reanimated/index.js +0 -4
- package/lib/module/reanimated/useReanimatedHeaderHeight.js +0 -10
- package/lib/module/reanimated/useReanimatedTransitionProgress.js +0 -10
- package/lib/module/types.js +0 -2
- package/lib/module/useTransitionProgress.js +0 -10
- package/lib/module/utils.js +0 -35
- package/src/TransitionProgressContext.tsx +0 -14
- package/src/components/DebugContainer.tsx +0 -46
- package/src/components/DebugContainer.web.tsx +0 -7
- package/src/components/FullWindowOverlay.tsx +0 -33
- package/src/components/FullWindowOverlay.web.tsx +0 -6
- package/src/components/Screen.tsx +0 -392
- package/src/components/Screen.web.tsx +0 -46
- package/src/components/ScreenContainer.tsx +0 -28
- package/src/components/ScreenContainer.web.tsx +0 -5
- package/src/components/ScreenContentWrapper.tsx +0 -9
- package/src/components/ScreenContentWrapper.web.tsx +0 -5
- package/src/components/ScreenFooter.tsx +0 -20
- package/src/components/ScreenFooter.web.tsx +0 -7
- package/src/components/ScreenStack.tsx +0 -112
- package/src/components/ScreenStack.web.tsx +0 -5
- package/src/components/ScreenStackHeaderConfig.tsx +0 -122
- package/src/components/ScreenStackHeaderConfig.web.tsx +0 -39
- package/src/components/ScreenStackItem.tsx +0 -174
- package/src/components/SearchBar.tsx +0 -102
- package/src/components/SearchBar.web.tsx +0 -5
- package/src/components/helpers/DelayedFreeze.tsx +0 -27
- package/src/components/helpers/usePrevious.tsx +0 -11
- package/src/contexts.tsx +0 -9
- package/src/core.ts +0 -45
- package/src/fabric/FullWindowOverlayNativeComponent.ts +0 -23
- package/src/fabric/ModalScreenNativeComponent.ts +0 -115
- package/src/fabric/NativeScreensModule.ts +0 -8
- package/src/fabric/NativeScreensModule.web.ts +0 -1
- package/src/fabric/ScreenContainerNativeComponent.ts +0 -28
- package/src/fabric/ScreenContentWrapperNativeComponent.ts +0 -14
- package/src/fabric/ScreenFooterNativeComponent.ts +0 -6
- package/src/fabric/ScreenNativeComponent.ts +0 -171
- package/src/fabric/ScreenNavigationContainerNativeComponent.ts +0 -12
- package/src/fabric/ScreenStackHeaderConfigNativeComponent.ts +0 -97
- package/src/fabric/ScreenStackHeaderSubviewNativeComponent.ts +0 -26
- package/src/fabric/ScreenStackNativeComponent.ts +0 -34
- package/src/fabric/SearchBarNativeComponent.ts +0 -83
- package/src/gesture-handler/GestureDetectorProvider.tsx +0 -16
- package/src/gesture-handler/RNScreensTurboModule.ts +0 -13
- package/src/gesture-handler/ScreenGestureDetector.tsx +0 -241
- package/src/gesture-handler/constraints.ts +0 -87
- package/src/gesture-handler/defaults.ts +0 -46
- package/src/gesture-handler/fabricUtils.ts +0 -86
- package/src/gesture-handler/fabricUtils.web.ts +0 -10
- package/src/gesture-handler/index.tsx +0 -4
- package/src/native-stack/contexts/GHContext.tsx +0 -9
- package/src/native-stack/index.tsx +0 -27
- package/src/native-stack/navigators/createNativeStackNavigator.tsx +0 -110
- package/src/native-stack/types.tsx +0 -659
- package/src/native-stack/utils/AnimatedHeaderHeightContext.tsx +0 -8
- package/src/native-stack/utils/HeaderHeightContext.tsx +0 -5
- package/src/native-stack/utils/SafeAreaProviderCompat.tsx +0 -78
- package/src/native-stack/utils/getDefaultHeaderHeight.tsx +0 -41
- package/src/native-stack/utils/getStatusBarHeight.tsx +0 -22
- package/src/native-stack/utils/useAnimatedHeaderHeight.tsx +0 -15
- package/src/native-stack/utils/useBackPressSubscription.tsx +0 -66
- package/src/native-stack/utils/useHeaderHeight.tsx +0 -15
- package/src/native-stack/views/FontProcessor.tsx +0 -14
- package/src/native-stack/views/FooterComponent.tsx +0 -10
- package/src/native-stack/views/HeaderConfig.tsx +0 -202
- package/src/native-stack/views/NativeStackView.tsx +0 -550
- package/src/reanimated/ReanimatedHeaderHeightContext.tsx +0 -7
- package/src/reanimated/ReanimatedNativeStackScreen.tsx +0 -132
- package/src/reanimated/ReanimatedScreen.tsx +0 -26
- package/src/reanimated/ReanimatedScreenProvider.tsx +0 -43
- package/src/reanimated/ReanimatedTransitionProgressContext.tsx +0 -13
- package/src/reanimated/index.tsx +0 -3
- package/src/reanimated/useReanimatedHeaderHeight.tsx +0 -14
- package/src/reanimated/useReanimatedTransitionProgress.tsx +0 -14
- package/src/types.tsx +0 -869
- package/src/useTransitionProgress.tsx +0 -15
- package/src/utils.ts +0 -40
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import { Dimensions, Platform, findNodeHandle } from 'react-native';
|
|
3
|
-
import { GestureDetector, Gesture } from 'react-native-gesture-handler';
|
|
4
|
-
import { useSharedValue, measure, startScreenTransition, finishScreenTransition, makeMutable, runOnUI } from 'react-native-reanimated';
|
|
5
|
-
import { getShadowNodeWrapperAndTagFromRef, isFabric } from './fabricUtils';
|
|
6
|
-
import { RNScreensTurboModule } from './RNScreensTurboModule';
|
|
7
|
-
import { DefaultEvent, DefaultScreenDimensions } from './defaults';
|
|
8
|
-
import { checkBoundaries, checkIfTransitionCancelled, getAnimationForTransition } from './constraints';
|
|
9
|
-
const EmptyGestureHandler = Gesture.Fling();
|
|
10
|
-
const ScreenGestureDetector = ({
|
|
11
|
-
children,
|
|
12
|
-
gestureDetectorBridge,
|
|
13
|
-
goBackGesture,
|
|
14
|
-
screenEdgeGesture,
|
|
15
|
-
transitionAnimation: customTransitionAnimation,
|
|
16
|
-
screensRefs,
|
|
17
|
-
currentScreenId
|
|
18
|
-
}) => {
|
|
19
|
-
const sharedEvent = useSharedValue(DefaultEvent);
|
|
20
|
-
const startingGesturePosition = useSharedValue(DefaultEvent);
|
|
21
|
-
const canPerformUpdates = makeMutable(false);
|
|
22
|
-
const transitionAnimation = getAnimationForTransition(goBackGesture, customTransitionAnimation);
|
|
23
|
-
const screenTransitionConfig = makeMutable({
|
|
24
|
-
stackTag: -1,
|
|
25
|
-
belowTopScreenId: -1,
|
|
26
|
-
topScreenId: -1,
|
|
27
|
-
sharedEvent,
|
|
28
|
-
startingGesturePosition,
|
|
29
|
-
screenTransition: transitionAnimation,
|
|
30
|
-
isTransitionCanceled: false,
|
|
31
|
-
goBackGesture: goBackGesture ?? 'swipeRight',
|
|
32
|
-
screenDimensions: DefaultScreenDimensions,
|
|
33
|
-
onFinishAnimation: () => {
|
|
34
|
-
'worklet';
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
const stackTag = makeMutable(-1);
|
|
38
|
-
const screenTagToNodeWrapperUI = makeMutable({});
|
|
39
|
-
const IS_FABRIC = isFabric();
|
|
40
|
-
gestureDetectorBridge.current.stackUseEffectCallback = stackRef => {
|
|
41
|
-
if (!goBackGesture) {
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
stackTag.value = findNodeHandle(stackRef.current);
|
|
45
|
-
if (Platform.OS === 'ios') {
|
|
46
|
-
runOnUI(() => {
|
|
47
|
-
RNScreensTurboModule.disableSwipeBackForTopScreen(stackTag.value);
|
|
48
|
-
})();
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
useEffect(() => {
|
|
52
|
-
if (!IS_FABRIC || !goBackGesture || screensRefs === undefined) {
|
|
53
|
-
return;
|
|
54
|
-
}
|
|
55
|
-
const screenTagToNodeWrapper = {};
|
|
56
|
-
for (const key in screensRefs.current) {
|
|
57
|
-
const screenRef = screensRefs.current[key];
|
|
58
|
-
const screenData = getShadowNodeWrapperAndTagFromRef(screenRef.current);
|
|
59
|
-
if (screenData.tag && screenData.shadowNodeWrapper) {
|
|
60
|
-
screenTagToNodeWrapper[screenData.tag] = screenData.shadowNodeWrapper;
|
|
61
|
-
} else {
|
|
62
|
-
console.warn('[RNScreens] Failed to find tag for screen.');
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
screenTagToNodeWrapperUI.value = screenTagToNodeWrapper;
|
|
66
|
-
}, [currentScreenId, goBackGesture]);
|
|
67
|
-
function computeProgress(event) {
|
|
68
|
-
'worklet';
|
|
69
|
-
|
|
70
|
-
let progress = 0;
|
|
71
|
-
const screenDimensions = screenTransitionConfig.value.screenDimensions;
|
|
72
|
-
const startingPosition = startingGesturePosition.value;
|
|
73
|
-
if (goBackGesture === 'swipeRight') {
|
|
74
|
-
progress = event.translationX / (screenDimensions.width - startingPosition.absoluteX);
|
|
75
|
-
} else if (goBackGesture === 'swipeLeft') {
|
|
76
|
-
progress = -1 * event.translationX / startingPosition.absoluteX;
|
|
77
|
-
} else if (goBackGesture === 'swipeDown') {
|
|
78
|
-
progress = -1 * event.translationY / (screenDimensions.height - startingPosition.absoluteY);
|
|
79
|
-
} else if (goBackGesture === 'swipeUp') {
|
|
80
|
-
progress = event.translationY / startingPosition.absoluteY;
|
|
81
|
-
} else if (goBackGesture === 'horizontalSwipe') {
|
|
82
|
-
progress = Math.abs(event.translationX / screenDimensions.width / 2);
|
|
83
|
-
} else if (goBackGesture === 'verticalSwipe') {
|
|
84
|
-
progress = Math.abs(event.translationY / screenDimensions.height / 2);
|
|
85
|
-
} else if (goBackGesture === 'twoDimensionalSwipe') {
|
|
86
|
-
const progressX = Math.abs(event.translationX / screenDimensions.width / 2);
|
|
87
|
-
const progressY = Math.abs(event.translationY / screenDimensions.height / 2);
|
|
88
|
-
progress = Math.max(progressX, progressY);
|
|
89
|
-
}
|
|
90
|
-
return progress;
|
|
91
|
-
}
|
|
92
|
-
function onStart(event) {
|
|
93
|
-
'worklet';
|
|
94
|
-
|
|
95
|
-
sharedEvent.value = event;
|
|
96
|
-
const transitionConfig = screenTransitionConfig.value;
|
|
97
|
-
const transitionData = RNScreensTurboModule.startTransition(stackTag.value);
|
|
98
|
-
if (transitionData.canStartTransition === false) {
|
|
99
|
-
canPerformUpdates.value = false;
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
if (IS_FABRIC) {
|
|
103
|
-
transitionConfig.topScreenId = screenTagToNodeWrapperUI.value[transitionData.topScreenTag];
|
|
104
|
-
transitionConfig.belowTopScreenId = screenTagToNodeWrapperUI.value[transitionData.belowTopScreenTag];
|
|
105
|
-
} else {
|
|
106
|
-
transitionConfig.topScreenId = transitionData.topScreenTag;
|
|
107
|
-
transitionConfig.belowTopScreenId = transitionData.belowTopScreenTag;
|
|
108
|
-
}
|
|
109
|
-
transitionConfig.stackTag = stackTag.value;
|
|
110
|
-
startingGesturePosition.value = event;
|
|
111
|
-
const animatedRefMock = () => {
|
|
112
|
-
return screenTransitionConfig.value.topScreenId;
|
|
113
|
-
};
|
|
114
|
-
const screenSize = measure(animatedRefMock);
|
|
115
|
-
if (screenSize == null) {
|
|
116
|
-
throw new Error('[RNScreens] Failed to measure screen.');
|
|
117
|
-
}
|
|
118
|
-
if (screenSize == null) {
|
|
119
|
-
canPerformUpdates.value = false;
|
|
120
|
-
RNScreensTurboModule.finishTransition(stackTag.value, true);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
transitionConfig.screenDimensions = screenSize;
|
|
124
|
-
startScreenTransition(transitionConfig);
|
|
125
|
-
canPerformUpdates.value = true;
|
|
126
|
-
}
|
|
127
|
-
function onUpdate(event) {
|
|
128
|
-
'worklet';
|
|
129
|
-
|
|
130
|
-
if (!canPerformUpdates.value) {
|
|
131
|
-
return;
|
|
132
|
-
}
|
|
133
|
-
checkBoundaries(goBackGesture, event);
|
|
134
|
-
const progress = computeProgress(event);
|
|
135
|
-
sharedEvent.value = event;
|
|
136
|
-
const stackTag = screenTransitionConfig.value.stackTag;
|
|
137
|
-
RNScreensTurboModule.updateTransition(stackTag, progress);
|
|
138
|
-
}
|
|
139
|
-
function onEnd(event) {
|
|
140
|
-
'worklet';
|
|
141
|
-
|
|
142
|
-
if (!canPerformUpdates.value) {
|
|
143
|
-
return;
|
|
144
|
-
}
|
|
145
|
-
const velocityFactor = 0.3;
|
|
146
|
-
const screenSize = screenTransitionConfig.value.screenDimensions;
|
|
147
|
-
const distanceX = event.translationX + Math.min(event.velocityX * velocityFactor, 100);
|
|
148
|
-
const distanceY = event.translationY + Math.min(event.velocityY * velocityFactor, 100);
|
|
149
|
-
const requiredXDistance = screenSize.width / 2;
|
|
150
|
-
const requiredYDistance = screenSize.height / 2;
|
|
151
|
-
const isTransitionCanceled = checkIfTransitionCancelled(goBackGesture, distanceX, requiredXDistance, distanceY, requiredYDistance);
|
|
152
|
-
const stackTag = screenTransitionConfig.value.stackTag;
|
|
153
|
-
screenTransitionConfig.value.onFinishAnimation = () => {
|
|
154
|
-
RNScreensTurboModule.finishTransition(stackTag, isTransitionCanceled);
|
|
155
|
-
};
|
|
156
|
-
screenTransitionConfig.value.isTransitionCanceled = isTransitionCanceled;
|
|
157
|
-
finishScreenTransition(screenTransitionConfig.value);
|
|
158
|
-
}
|
|
159
|
-
let panGesture = Gesture.Pan().onStart(onStart).onUpdate(onUpdate).onEnd(onEnd);
|
|
160
|
-
if (screenEdgeGesture) {
|
|
161
|
-
const HIT_SLOP_SIZE = 50;
|
|
162
|
-
const ACTIVATION_DISTANCE = 30;
|
|
163
|
-
if (goBackGesture === 'swipeRight') {
|
|
164
|
-
panGesture = panGesture.activeOffsetX(ACTIVATION_DISTANCE).hitSlop({
|
|
165
|
-
left: 0,
|
|
166
|
-
top: 0,
|
|
167
|
-
width: HIT_SLOP_SIZE
|
|
168
|
-
});
|
|
169
|
-
} else if (goBackGesture === 'swipeLeft') {
|
|
170
|
-
panGesture = panGesture.activeOffsetX(-ACTIVATION_DISTANCE).hitSlop({
|
|
171
|
-
right: 0,
|
|
172
|
-
top: 0,
|
|
173
|
-
width: HIT_SLOP_SIZE
|
|
174
|
-
});
|
|
175
|
-
} else if (goBackGesture === 'swipeDown') {
|
|
176
|
-
panGesture = panGesture.activeOffsetY(ACTIVATION_DISTANCE).hitSlop({
|
|
177
|
-
top: 0,
|
|
178
|
-
height: Dimensions.get('window').height * 0.2
|
|
179
|
-
});
|
|
180
|
-
// workaround, because we don't have access to header height
|
|
181
|
-
} else if (goBackGesture === 'swipeUp') {
|
|
182
|
-
panGesture = panGesture.activeOffsetY(-ACTIVATION_DISTANCE).hitSlop({
|
|
183
|
-
bottom: 0,
|
|
184
|
-
height: HIT_SLOP_SIZE
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
return /*#__PURE__*/React.createElement(GestureDetector, {
|
|
189
|
-
gesture: goBackGesture ? panGesture : EmptyGestureHandler
|
|
190
|
-
}, children);
|
|
191
|
-
};
|
|
192
|
-
export default ScreenGestureDetector;
|
|
193
|
-
//# sourceMappingURL=ScreenGestureDetector.js.map
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { ScreenTransition } from 'react-native-reanimated';
|
|
2
|
-
import { AnimationForGesture } from './defaults';
|
|
3
|
-
const SupportedGestures = ['swipeRight', 'swipeLeft', 'swipeDown', 'swipeUp', 'horizontalSwipe', 'verticalSwipe', 'twoDimensionalSwipe'];
|
|
4
|
-
export function getAnimationForTransition(goBackGesture, customTransitionAnimation) {
|
|
5
|
-
let transitionAnimation = ScreenTransition.SwipeRight;
|
|
6
|
-
if (customTransitionAnimation) {
|
|
7
|
-
transitionAnimation = customTransitionAnimation;
|
|
8
|
-
if (!goBackGesture) {
|
|
9
|
-
throw new Error('[RNScreens] You have to specify `goBackGesture` when using `transitionAnimation`.');
|
|
10
|
-
}
|
|
11
|
-
} else {
|
|
12
|
-
if (!!goBackGesture && SupportedGestures.includes(goBackGesture)) {
|
|
13
|
-
transitionAnimation = AnimationForGesture[goBackGesture];
|
|
14
|
-
} else if (goBackGesture !== undefined) {
|
|
15
|
-
throw new Error(`[RNScreens] Unknown goBackGesture parameter has been specified: ${goBackGesture}.`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return transitionAnimation;
|
|
19
|
-
}
|
|
20
|
-
export function checkBoundaries(goBackGesture, event) {
|
|
21
|
-
'worklet';
|
|
22
|
-
|
|
23
|
-
if (goBackGesture === 'swipeRight' && event.translationX < 0) {
|
|
24
|
-
event.translationX = 0;
|
|
25
|
-
} else if (goBackGesture === 'swipeLeft' && event.translationX > 0) {
|
|
26
|
-
event.translationX = 0;
|
|
27
|
-
} else if (goBackGesture === 'swipeDown' && event.translationY < 0) {
|
|
28
|
-
event.translationY = 0;
|
|
29
|
-
} else if (goBackGesture === 'swipeUp' && event.translationY > 0) {
|
|
30
|
-
event.translationY = 0;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
export function checkIfTransitionCancelled(goBackGesture, distanceX, requiredXDistance, distanceY, requiredYDistance) {
|
|
34
|
-
'worklet';
|
|
35
|
-
|
|
36
|
-
let isTransitionCanceled = false;
|
|
37
|
-
if (goBackGesture === 'swipeRight') {
|
|
38
|
-
isTransitionCanceled = distanceX < requiredXDistance;
|
|
39
|
-
} else if (goBackGesture === 'swipeLeft') {
|
|
40
|
-
isTransitionCanceled = -distanceX < requiredXDistance;
|
|
41
|
-
} else if (goBackGesture === 'horizontalSwipe') {
|
|
42
|
-
isTransitionCanceled = Math.abs(distanceX) < requiredXDistance;
|
|
43
|
-
} else if (goBackGesture === 'swipeUp') {
|
|
44
|
-
isTransitionCanceled = -distanceY < requiredYDistance;
|
|
45
|
-
} else if (goBackGesture === 'swipeDown') {
|
|
46
|
-
isTransitionCanceled = distanceY < requiredYDistance;
|
|
47
|
-
} else if (goBackGesture === 'verticalSwipe') {
|
|
48
|
-
isTransitionCanceled = Math.abs(distanceY) < requiredYDistance;
|
|
49
|
-
} else if (goBackGesture === 'twoDimensionalSwipe') {
|
|
50
|
-
const isCanceledHorizontally = Math.abs(distanceX) < requiredXDistance;
|
|
51
|
-
const isCanceledVertically = Math.abs(distanceY) < requiredYDistance;
|
|
52
|
-
isTransitionCanceled = isCanceledHorizontally && isCanceledVertically;
|
|
53
|
-
}
|
|
54
|
-
return isTransitionCanceled;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=constraints.js.map
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { PointerType } from 'react-native-gesture-handler';
|
|
2
|
-
import { ScreenTransition } from 'react-native-reanimated';
|
|
3
|
-
export const DefaultEvent = {
|
|
4
|
-
absoluteX: 0,
|
|
5
|
-
absoluteY: 0,
|
|
6
|
-
handlerTag: 0,
|
|
7
|
-
numberOfPointers: 0,
|
|
8
|
-
state: 0,
|
|
9
|
-
translationX: 0,
|
|
10
|
-
translationY: 0,
|
|
11
|
-
velocityX: 0,
|
|
12
|
-
velocityY: 0,
|
|
13
|
-
x: 0,
|
|
14
|
-
y: 0,
|
|
15
|
-
// These two were added in recent versions of gesture handler
|
|
16
|
-
// and they are required to specify. This should be backward
|
|
17
|
-
// compatible unless they strictly parse the objects, which seems
|
|
18
|
-
// not likely. PointerType is present since 2.16.0, StylusData since 2.20.0
|
|
19
|
-
pointerType: PointerType.TOUCH,
|
|
20
|
-
stylusData: undefined
|
|
21
|
-
};
|
|
22
|
-
export const DefaultScreenDimensions = {
|
|
23
|
-
width: 0,
|
|
24
|
-
height: 0,
|
|
25
|
-
x: 0,
|
|
26
|
-
y: 0,
|
|
27
|
-
pageX: 0,
|
|
28
|
-
pageY: 0
|
|
29
|
-
};
|
|
30
|
-
export const AnimationForGesture = {
|
|
31
|
-
swipeRight: ScreenTransition.SwipeRight,
|
|
32
|
-
swipeLeft: ScreenTransition.SwipeLeft,
|
|
33
|
-
swipeDown: ScreenTransition.SwipeDown,
|
|
34
|
-
swipeUp: ScreenTransition.SwipeUp,
|
|
35
|
-
horizontalSwipe: ScreenTransition.Horizontal,
|
|
36
|
-
verticalSwipe: ScreenTransition.Vertical,
|
|
37
|
-
twoDimensionalSwipe: ScreenTransition.TwoDimensional
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=defaults.js.map
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/* eslint-disable */
|
|
4
|
-
|
|
5
|
-
export function isFabric() {
|
|
6
|
-
return !!global._IS_FABRIC;
|
|
7
|
-
}
|
|
8
|
-
let findHostInstance_DEPRECATED;
|
|
9
|
-
let getInternalInstanceHandleFromPublicInstance;
|
|
10
|
-
|
|
11
|
-
// Taken and modifies from reanimated
|
|
12
|
-
export function getShadowNodeWrapperAndTagFromRef(ref) {
|
|
13
|
-
// load findHostInstance_DEPRECATED lazily because it may not be available before render
|
|
14
|
-
if (findHostInstance_DEPRECATED === undefined) {
|
|
15
|
-
try {
|
|
16
|
-
findHostInstance_DEPRECATED = require('react-native/Libraries/Renderer/shims/ReactFabric').findHostInstance_DEPRECATED;
|
|
17
|
-
} catch (e) {
|
|
18
|
-
findHostInstance_DEPRECATED = _ref => null;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
if (getInternalInstanceHandleFromPublicInstance === undefined) {
|
|
22
|
-
try {
|
|
23
|
-
getInternalInstanceHandleFromPublicInstance = require('react-native/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance').getInternalInstanceHandleFromPublicInstance ?? (_ref => _ref._internalInstanceHandle);
|
|
24
|
-
} catch (e) {
|
|
25
|
-
getInternalInstanceHandleFromPublicInstance = _ref => _ref._internalInstanceHandle;
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// taken from https://github.com/facebook/react-native/commit/803bb16531697233686efd475f004c1643e03617#diff-d8172256c6d63b5d32db10e54d7b10f37a26b337d5280d89f5bfd7bcea778292R196
|
|
30
|
-
// @ts-ignore some weird stuff on RN 0.74 - see examples with scrollView
|
|
31
|
-
const scrollViewRef = ref?.getScrollResponder?.()?.getNativeScrollRef?.();
|
|
32
|
-
// @ts-ignore some weird stuff on RN 0.74 - see examples with scrollView
|
|
33
|
-
const otherScrollViewRef = ref?.getNativeScrollRef?.();
|
|
34
|
-
// @ts-ignore some weird stuff on RN 0.74 - see setNativeProps example
|
|
35
|
-
const textInputRef = ref?.__internalInstanceHandle?.stateNode?.node;
|
|
36
|
-
let resolvedRef;
|
|
37
|
-
if (scrollViewRef) {
|
|
38
|
-
resolvedRef = {
|
|
39
|
-
shadowNodeWrapper: scrollViewRef.__internalInstanceHandle.stateNode.node,
|
|
40
|
-
tag: scrollViewRef._nativeTag
|
|
41
|
-
};
|
|
42
|
-
} else if (otherScrollViewRef) {
|
|
43
|
-
resolvedRef = {
|
|
44
|
-
shadowNodeWrapper: otherScrollViewRef.__internalInstanceHandle.stateNode.node,
|
|
45
|
-
tag: otherScrollViewRef.__nativeTag
|
|
46
|
-
};
|
|
47
|
-
} else if (textInputRef) {
|
|
48
|
-
resolvedRef = {
|
|
49
|
-
shadowNodeWrapper: textInputRef,
|
|
50
|
-
tag: ref?.__nativeTag
|
|
51
|
-
};
|
|
52
|
-
} else {
|
|
53
|
-
const hostInstance = findHostInstance_DEPRECATED(ref);
|
|
54
|
-
resolvedRef = {
|
|
55
|
-
shadowNodeWrapper: getInternalInstanceHandleFromPublicInstance(hostInstance).stateNode.node,
|
|
56
|
-
tag: hostInstance?._nativeTag
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
return resolvedRef;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=fabricUtils.js.map
|
package/lib/module/index.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
// Side effects import declaration to ensure our TurboModule
|
|
2
|
-
// is loaded.
|
|
3
|
-
import './fabric/NativeScreensModule';
|
|
4
|
-
export * from './types';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Core
|
|
8
|
-
*/
|
|
9
|
-
export { enableScreens, enableFreeze, screensEnabled, freezeEnabled } from './core';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* RNS Components
|
|
13
|
-
*/
|
|
14
|
-
export { default as Screen, InnerScreen, ScreenContext } from './components/Screen';
|
|
15
|
-
export { ScreenStackHeaderConfig, ScreenStackHeaderSubview, ScreenStackHeaderLeftView, ScreenStackHeaderCenterView, ScreenStackHeaderRightView, ScreenStackHeaderBackButtonImage, ScreenStackHeaderSearchBarView } from './components/ScreenStackHeaderConfig';
|
|
16
|
-
export { default as SearchBar } from './components/SearchBar';
|
|
17
|
-
export { default as ScreenContainer } from './components/ScreenContainer';
|
|
18
|
-
export { default as ScreenStack } from './components/ScreenStack';
|
|
19
|
-
export { default as ScreenStackItem } from './components/ScreenStackItem';
|
|
20
|
-
export { default as FullWindowOverlay } from './components/FullWindowOverlay';
|
|
21
|
-
export { default as ScreenFooter } from './components/ScreenFooter';
|
|
22
|
-
export { default as ScreenContentWrapper } from './components/ScreenContentWrapper';
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* Utils
|
|
26
|
-
*/
|
|
27
|
-
export { isSearchBarAvailableForCurrentPlatform, compatibilityFlags, executeNativeBackPress } from './utils';
|
|
28
|
-
|
|
29
|
-
/**
|
|
30
|
-
* Hooks
|
|
31
|
-
*/
|
|
32
|
-
export { default as useTransitionProgress } from './useTransitionProgress';
|
|
33
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import React from 'react';
|
|
4
|
-
// context to be used when the user wants full screen swipe (see `gesture-handler` folder in repo)
|
|
5
|
-
export const GHContext = /*#__PURE__*/React.createContext(props => /*#__PURE__*/React.createElement(React.Fragment, null, props.children));
|
|
6
|
-
//# sourceMappingURL=GHContext.js.map
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Navigators
|
|
3
|
-
*/
|
|
4
|
-
export { default as createNativeStackNavigator } from './navigators/createNativeStackNavigator';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Views
|
|
8
|
-
*/
|
|
9
|
-
export { default as NativeStackView } from './views/NativeStackView';
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Utilities
|
|
13
|
-
*/
|
|
14
|
-
export { default as useHeaderHeight } from './utils/useHeaderHeight';
|
|
15
|
-
export { default as HeaderHeightContext } from './utils/HeaderHeightContext';
|
|
16
|
-
export { default as useAnimatedHeaderHeight } from './utils/useAnimatedHeaderHeight';
|
|
17
|
-
export { default as AnimatedHeaderHeightContext } from './utils/AnimatedHeaderHeightContext';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Types
|
|
21
|
-
*/
|
|
22
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
2
|
-
/*
|
|
3
|
-
* Portions of this file are copyright (c) 2023 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
4
|
-
*
|
|
5
|
-
* PORTIONS OF THIS FILE ARE AMAZON PROPRIETARY/CONFIDENTIAL. USE IS SUBJECT TO LICENSE TERMS.
|
|
6
|
-
*
|
|
7
|
-
* Amazon modifications are indicated by [amznmod_* comments].
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
/*
|
|
11
|
-
* Changelog:
|
|
12
|
-
* Set up react-native-screens package to build for Kepler
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
import { createNavigatorFactory, StackActions, StackRouter, useNavigationBuilder
|
|
16
|
-
// amznmod_react - change imports to kepler packages
|
|
17
|
-
} from '@amazon-devices/react-navigation__native';
|
|
18
|
-
import * as React from 'react';
|
|
19
|
-
import NativeStackView from '../views/NativeStackView';
|
|
20
|
-
function NativeStackNavigator({
|
|
21
|
-
initialRouteName,
|
|
22
|
-
children,
|
|
23
|
-
screenOptions,
|
|
24
|
-
...rest
|
|
25
|
-
}) {
|
|
26
|
-
const {
|
|
27
|
-
state,
|
|
28
|
-
descriptors,
|
|
29
|
-
navigation
|
|
30
|
-
} = useNavigationBuilder(StackRouter, {
|
|
31
|
-
initialRouteName,
|
|
32
|
-
children,
|
|
33
|
-
screenOptions
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// Starting from React Navigation v6, `native-stack` should be imported from
|
|
37
|
-
// `@react-navigation/native-stack` rather than `react-native-screens/native-stack`
|
|
38
|
-
React.useEffect(() => {
|
|
39
|
-
// @ts-ignore navigation.dangerouslyGetParent was removed in v6
|
|
40
|
-
if (navigation?.dangerouslyGetParent === undefined) {
|
|
41
|
-
console.warn('Looks like you are importing `native-stack` from `react-native-screens/native-stack`. Since version 6 of `react-navigation`, it should be imported from `@react-navigation/native-stack`.');
|
|
42
|
-
}
|
|
43
|
-
}, [navigation]);
|
|
44
|
-
React.useEffect(() =>
|
|
45
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
46
|
-
navigation?.addListener?.('tabPress', e => {
|
|
47
|
-
const isFocused = navigation.isFocused();
|
|
48
|
-
|
|
49
|
-
// Run the operation in the next frame so we're sure all listeners have been run
|
|
50
|
-
// This is necessary to know if preventDefault() has been called
|
|
51
|
-
requestAnimationFrame(() => {
|
|
52
|
-
if (state.index > 0 && isFocused && !e.defaultPrevented) {
|
|
53
|
-
// When user taps on already focused tab and we're inside the tab,
|
|
54
|
-
// reset the stack to replicate native behaviour
|
|
55
|
-
navigation.dispatch({
|
|
56
|
-
...StackActions.popToTop(),
|
|
57
|
-
target: state.key
|
|
58
|
-
});
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
}), [navigation, state.index, state.key]);
|
|
62
|
-
return /*#__PURE__*/React.createElement(NativeStackView, _extends({}, rest, {
|
|
63
|
-
state: state,
|
|
64
|
-
navigation: navigation,
|
|
65
|
-
descriptors: descriptors
|
|
66
|
-
}));
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* @deprecated NativeStack has been moved from react-native-screens/native-stack to @react-navigation/native since version v6. With react-native-screens v4 native stack v5 (react-native-screens/native-stack) is deprecated and marked for removal in the upcoming minor release, react-native-screens v4 will support only @react-navigation/native-stack v7.
|
|
71
|
-
*/
|
|
72
|
-
export default createNavigatorFactory(NativeStackNavigator);
|
|
73
|
-
//# sourceMappingURL=createNativeStackNavigator.js.map
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* Portions of this file are copyright (c) 2023 Amazon.com, Inc. or its affiliates. All rights reserved.
|
|
3
|
-
*
|
|
4
|
-
* PORTIONS OF THIS FILE ARE AMAZON PROPRIETARY/CONFIDENTIAL. USE IS SUBJECT TO LICENSE TERMS.
|
|
5
|
-
*
|
|
6
|
-
* Amazon modifications are indicated by [amznmod_* comments].
|
|
7
|
-
*/
|
|
8
|
-
|
|
9
|
-
/*
|
|
10
|
-
* Changelog:
|
|
11
|
-
* Set up react-native-screens package to build for Kepler
|
|
12
|
-
*/
|
|
13
|
-
|
|
14
|
-
// code taken from
|
|
15
|
-
// https://github.com/react-navigation/react-navigation/blob/ec0d113eb25c39ef9defb6c7215640f44e3569ae/packages/elements/src/SafeAreaProviderCompat.tsx
|
|
16
|
-
import * as React from 'react';
|
|
17
|
-
import { Dimensions, Platform, StyleSheet, View } from 'react-native';
|
|
18
|
-
import { initialWindowMetrics, SafeAreaInsetsContext, SafeAreaProvider
|
|
19
|
-
// amznmod_react - change imports to kepler packages
|
|
20
|
-
} from '@amazon-devices/react-native-safe-area-context';
|
|
21
|
-
const {
|
|
22
|
-
width = 0,
|
|
23
|
-
height = 0
|
|
24
|
-
} = Dimensions.get('window');
|
|
25
|
-
|
|
26
|
-
// To support SSR on web, we need to have empty insets for initial values
|
|
27
|
-
// Otherwise there can be mismatch between SSR and client output
|
|
28
|
-
// We also need to specify empty values to support tests environments
|
|
29
|
-
const initialMetrics = Platform.OS === 'web' || initialWindowMetrics == null ? {
|
|
30
|
-
frame: {
|
|
31
|
-
x: 0,
|
|
32
|
-
y: 0,
|
|
33
|
-
width,
|
|
34
|
-
height
|
|
35
|
-
},
|
|
36
|
-
insets: {
|
|
37
|
-
top: 0,
|
|
38
|
-
left: 0,
|
|
39
|
-
right: 0,
|
|
40
|
-
bottom: 0
|
|
41
|
-
}
|
|
42
|
-
} : initialWindowMetrics;
|
|
43
|
-
export default function SafeAreaProviderCompat({
|
|
44
|
-
children,
|
|
45
|
-
style
|
|
46
|
-
}) {
|
|
47
|
-
return /*#__PURE__*/React.createElement(SafeAreaInsetsContext.Consumer, null, insets => {
|
|
48
|
-
if (insets) {
|
|
49
|
-
// If we already have insets, don't wrap the stack in another safe area provider
|
|
50
|
-
// This avoids an issue with updates at the cost of potentially incorrect values
|
|
51
|
-
// https://github.com/react-navigation/react-navigation/issues/174
|
|
52
|
-
return /*#__PURE__*/React.createElement(View, {
|
|
53
|
-
style: [styles.container, style]
|
|
54
|
-
}, children);
|
|
55
|
-
}
|
|
56
|
-
return /*#__PURE__*/React.createElement(SafeAreaProvider, {
|
|
57
|
-
initialMetrics: initialMetrics,
|
|
58
|
-
style: style
|
|
59
|
-
}, children);
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
SafeAreaProviderCompat.initialMetrics = initialMetrics;
|
|
63
|
-
const styles = StyleSheet.create({
|
|
64
|
-
container: {
|
|
65
|
-
flex: 1
|
|
66
|
-
}
|
|
67
|
-
});
|
|
68
|
-
//# sourceMappingURL=SafeAreaProviderCompat.js.map
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Platform } from 'react-native';
|
|
2
|
-
const formSheetModalHeight = 56;
|
|
3
|
-
export default function getDefaultHeaderHeight(layout, statusBarHeight, stackPresentation, isLargeHeader = false) {
|
|
4
|
-
// default header heights
|
|
5
|
-
let headerHeight = Platform.OS === 'android' ? 56 : 64;
|
|
6
|
-
if (Platform.OS === 'ios') {
|
|
7
|
-
const isLandscape = layout.width > layout.height;
|
|
8
|
-
const isFormSheetModal = stackPresentation === 'modal' || stackPresentation === 'formSheet';
|
|
9
|
-
if (isFormSheetModal && !isLandscape) {
|
|
10
|
-
// `modal` and `formSheet` presentations do not take whole screen, so should not take the inset.
|
|
11
|
-
statusBarHeight = 0;
|
|
12
|
-
}
|
|
13
|
-
if (Platform.isPad || Platform.isTV) {
|
|
14
|
-
headerHeight = isFormSheetModal ? formSheetModalHeight : 50;
|
|
15
|
-
} else {
|
|
16
|
-
if (isLandscape) {
|
|
17
|
-
headerHeight = 32;
|
|
18
|
-
} else {
|
|
19
|
-
if (isFormSheetModal) {
|
|
20
|
-
headerHeight = formSheetModalHeight;
|
|
21
|
-
} else {
|
|
22
|
-
headerHeight = isLargeHeader ? 96 : 44;
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return headerHeight + statusBarHeight;
|
|
28
|
-
}
|
|
29
|
-
//# sourceMappingURL=getDefaultHeaderHeight.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { Platform } from 'react-native';
|
|
2
|
-
export default function getStatusBarHeight(topInset, dimensions, isStatusBarTranslucent) {
|
|
3
|
-
if (Platform.OS === 'ios') {
|
|
4
|
-
// It looks like some iOS devices don't have strictly set status bar height to 44.
|
|
5
|
-
// Thus, if the top inset is higher than 50, then the device should have a dynamic island.
|
|
6
|
-
// On models with Dynamic Island the status bar height is smaller than the safe area top inset by 5 pixels.
|
|
7
|
-
// See https://developer.apple.com/forums/thread/662466 for more details about status bar height.
|
|
8
|
-
const hasDynamicIsland = topInset > 50;
|
|
9
|
-
return hasDynamicIsland ? topInset - 5 : topInset;
|
|
10
|
-
} else if (Platform.OS === 'android') {
|
|
11
|
-
// On Android we should also rely on frame's y-axis position, as topInset is 0 on visible status bar.
|
|
12
|
-
return isStatusBarTranslucent ? topInset : dimensions.y;
|
|
13
|
-
}
|
|
14
|
-
return topInset;
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=getStatusBarHeight.js.map
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import AnimatedHeaderHeightContext from './AnimatedHeaderHeightContext';
|
|
3
|
-
export default function useAnimatedHeaderHeight() {
|
|
4
|
-
const animatedValue = React.useContext(AnimatedHeaderHeightContext);
|
|
5
|
-
if (animatedValue === undefined) {
|
|
6
|
-
throw new Error("Couldn't find the header height. Are you inside a screen in a navigator with a header?");
|
|
7
|
-
}
|
|
8
|
-
return animatedValue;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=useAnimatedHeaderHeight.js.map
|