@amazon-devices/react-navigation__stack 7.0.9000000000 → 8.0.9000000000-rn-83
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/03e0ad8b8bcf16e659904adab730cbe9c1832c4a36017809f129fea7fb07b4fc.bundle +13453 -0
- package/SystemBundles/03e0ad8b8bcf16e659904adab730cbe9c1832c4a36017809f129fea7fb07b4fc.map +4627 -0
- package/SystemModules/amzn__react-navigation__stack-8.modules.txt +32 -0
- package/SystemModules/amzn__react-navigation__stack-8.private.modules.txt +91 -0
- package/SystemModules/keplerscript-system-bundle-config.json +4 -4
- package/kepler-compatibility.json +2 -2
- 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 +246 -181
- 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/oss-attribution/attribution.txt +76 -0
- package/oss-attribution/licenseInfos.json +27 -0
- package/package.json +105 -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 +375 -243
- package/src/views/Stack/StackView.tsx +73 -62
- package/SystemBundles/c55a41e7975f46f901d6afe3b0331d043bdbf1f54f96209de0215cf6f6fd5377.bundle +0 -28130
- package/SystemBundles/c55a41e7975f46f901d6afe3b0331d043bdbf1f54f96209de0215cf6f6fd5377.map +0 -8489
- package/SystemModules/amzn__react-navigation__stack-7.modules.txt +0 -95
- package/SystemModules/amzn__react-navigation__stack-7.private.modules.txt +0 -191
- 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 -443
- 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,16 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { getDefaultHeaderHeight, SafeAreaProviderCompat } from '@amazon-devices/react-navigation__elements';
|
|
3
4
|
import * as React from 'react';
|
|
4
|
-
import { Animated, Platform, StyleSheet } from 'react-native';
|
|
5
|
-
import { forModalPresentationIOS, forNoAnimation as forNoAnimationCard } from
|
|
6
|
-
import { DefaultTransition, ModalFadeTransition, ModalTransition } from
|
|
7
|
-
import findLastIndex from
|
|
8
|
-
import getDistanceForDirection from
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import CardContainer from
|
|
5
|
+
import { Animated, Platform, StyleSheet, View } from 'react-native';
|
|
6
|
+
import { forModalPresentationIOS, forNoAnimation as forNoAnimationCard } from "../../TransitionConfigs/CardStyleInterpolators.js";
|
|
7
|
+
import { BottomSheetAndroid, DefaultTransition, FadeFromBottomAndroid, FadeFromRightAndroid, ModalFadeTransition, ModalSlideFromBottomIOS, ModalTransition, RevealFromBottomAndroid, ScaleFromCenterAndroid, SlideFromLeftIOS, SlideFromRightIOS } from "../../TransitionConfigs/TransitionPresets.js";
|
|
8
|
+
import { findLastIndex } from "../../utils/findLastIndex.js";
|
|
9
|
+
import { getDistanceForDirection } from "../../utils/getDistanceForDirection.js";
|
|
10
|
+
import { getModalRouteKeys } from "../../utils/getModalRoutesKeys.js";
|
|
11
|
+
import { MaybeScreen, MaybeScreenContainer } from "../Screens.js";
|
|
12
|
+
import { CardContainer } from "./CardContainer.js";
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
const NAMED_TRANSITIONS_PRESETS = {
|
|
15
|
+
default: DefaultTransition,
|
|
16
|
+
fade: ModalFadeTransition,
|
|
17
|
+
fade_from_bottom: FadeFromBottomAndroid,
|
|
18
|
+
fade_from_right: FadeFromRightAndroid,
|
|
19
|
+
none: DefaultTransition,
|
|
20
|
+
reveal_from_bottom: RevealFromBottomAndroid,
|
|
21
|
+
scale_from_center: ScaleFromCenterAndroid,
|
|
22
|
+
slide_from_left: SlideFromLeftIOS,
|
|
23
|
+
slide_from_right: SlideFromRightIOS,
|
|
24
|
+
slide_from_bottom: Platform.select({
|
|
25
|
+
ios: ModalSlideFromBottomIOS,
|
|
26
|
+
default: BottomSheetAndroid
|
|
27
|
+
})
|
|
28
|
+
};
|
|
29
|
+
const EPSILON = 1e-5;
|
|
12
30
|
const STATE_INACTIVE = 0;
|
|
13
31
|
const STATE_TRANSITIONING_OR_BELOW_TOP = 1;
|
|
32
|
+
const STATE_ON_TOP = 2;
|
|
14
33
|
const FALLBACK_DESCRIPTOR = Object.freeze({
|
|
15
34
|
options: {}
|
|
16
35
|
});
|
|
@@ -22,8 +41,7 @@ const getInterpolationIndex = (scenes, index) => {
|
|
|
22
41
|
// Start from current card and count backwards the number of cards with same interpolation
|
|
23
42
|
let interpolationIndex = 0;
|
|
24
43
|
for (let i = index - 1; i >= 0; i--) {
|
|
25
|
-
|
|
26
|
-
const cardStyleInterpolatorCurrent = (_scenes$i = scenes[i]) === null || _scenes$i === void 0 ? void 0 : _scenes$i.descriptor.options.cardStyleInterpolator;
|
|
44
|
+
const cardStyleInterpolatorCurrent = scenes[i]?.descriptor.options.cardStyleInterpolator;
|
|
27
45
|
if (cardStyleInterpolatorCurrent !== cardStyleInterpolator) {
|
|
28
46
|
break;
|
|
29
47
|
}
|
|
@@ -31,6 +49,11 @@ const getInterpolationIndex = (scenes, index) => {
|
|
|
31
49
|
}
|
|
32
50
|
return interpolationIndex;
|
|
33
51
|
};
|
|
52
|
+
const getIsModalPresentation = cardStyleInterpolator => {
|
|
53
|
+
return cardStyleInterpolator === forModalPresentationIOS ||
|
|
54
|
+
// Handle custom modal presentation interpolators as well
|
|
55
|
+
cardStyleInterpolator.name === 'forModalPresentationIOS';
|
|
56
|
+
};
|
|
34
57
|
const getIsModal = (scene, interpolationIndex, isParentModal) => {
|
|
35
58
|
if (isParentModal) {
|
|
36
59
|
return true;
|
|
@@ -56,20 +79,21 @@ const getHeaderHeights = (scenes, insets, isParentHeaderShown, isParentModal, la
|
|
|
56
79
|
return acc;
|
|
57
80
|
}, {});
|
|
58
81
|
};
|
|
59
|
-
const getDistanceFromOptions = (layout,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
82
|
+
const getDistanceFromOptions = (layout, options, isRTL) => {
|
|
83
|
+
if (options?.gestureDirection) {
|
|
84
|
+
return getDistanceForDirection(layout, options.gestureDirection, isRTL);
|
|
85
|
+
}
|
|
86
|
+
const defaultGestureDirection = options?.presentation === 'modal' ? ModalTransition.gestureDirection : DefaultTransition.gestureDirection;
|
|
87
|
+
const gestureDirection = options?.animation ? NAMED_TRANSITIONS_PRESETS[options?.animation]?.gestureDirection : defaultGestureDirection;
|
|
88
|
+
return getDistanceForDirection(layout, gestureDirection, isRTL);
|
|
65
89
|
};
|
|
66
|
-
const getProgressFromGesture = (gesture, layout,
|
|
90
|
+
const getProgressFromGesture = (gesture, layout, options, isRTL) => {
|
|
67
91
|
const distance = getDistanceFromOptions({
|
|
68
92
|
// Make sure that we have a non-zero distance, otherwise there will be incorrect progress
|
|
69
93
|
// This causes blank screen on web if it was previously inside container with display: none
|
|
70
94
|
width: Math.max(1, layout.width),
|
|
71
95
|
height: Math.max(1, layout.height)
|
|
72
|
-
},
|
|
96
|
+
}, options, isRTL);
|
|
73
97
|
if (distance > 0) {
|
|
74
98
|
return gesture.interpolate({
|
|
75
99
|
inputRange: [0, distance],
|
|
@@ -81,55 +105,75 @@ const getProgressFromGesture = (gesture, layout, descriptor) => {
|
|
|
81
105
|
outputRange: [0, 1]
|
|
82
106
|
});
|
|
83
107
|
};
|
|
84
|
-
|
|
108
|
+
function getDefaultAnimation(animation) {
|
|
109
|
+
// Disable screen transition animation by default on web, windows and macos to match the native behavior
|
|
110
|
+
const excludedPlatforms = Platform.OS !== 'web' && Platform.OS !== 'windows' && Platform.OS !== 'macos';
|
|
111
|
+
return animation ?? (excludedPlatforms ? 'default' : 'none');
|
|
112
|
+
}
|
|
113
|
+
export function getAnimationEnabled(animation) {
|
|
114
|
+
return getDefaultAnimation(animation) !== 'none';
|
|
115
|
+
}
|
|
116
|
+
export class CardStack extends React.Component {
|
|
85
117
|
static getDerivedStateFromProps(props, state) {
|
|
86
118
|
if (props.routes === state.routes && props.descriptors === state.descriptors) {
|
|
87
119
|
return null;
|
|
88
120
|
}
|
|
89
|
-
const gestures = props.routes.reduce((acc, curr) => {
|
|
90
|
-
const descriptor = props.descriptors[curr.key];
|
|
121
|
+
const gestures = [...props.routes, ...props.state.preloadedRoutes].reduce((acc, curr) => {
|
|
122
|
+
const descriptor = props.descriptors[curr.key] || props.preloadedDescriptors[curr.key];
|
|
91
123
|
const {
|
|
92
|
-
|
|
93
|
-
} =
|
|
94
|
-
acc[curr.key] = state.gestures[curr.key] || new Animated.Value(props.openingRouteKeys.includes(curr.key) &&
|
|
124
|
+
animation
|
|
125
|
+
} = descriptor?.options || {};
|
|
126
|
+
acc[curr.key] = state.gestures[curr.key] || new Animated.Value(props.openingRouteKeys.includes(curr.key) && getAnimationEnabled(animation) || props.state.preloadedRoutes.includes(curr) ? getDistanceFromOptions(state.layout, descriptor?.options, props.direction === 'rtl') : 0);
|
|
95
127
|
return acc;
|
|
96
128
|
}, {});
|
|
97
|
-
const
|
|
98
|
-
|
|
99
|
-
|
|
129
|
+
const modalRouteKeys = getModalRouteKeys([...props.routes, ...props.state.preloadedRoutes], {
|
|
130
|
+
...props.descriptors,
|
|
131
|
+
...props.preloadedDescriptors
|
|
132
|
+
});
|
|
133
|
+
const scenes = [...props.routes, ...props.state.preloadedRoutes].map((route, index, self) => {
|
|
134
|
+
// For preloaded screens, we don't care about the previous and the next screen
|
|
135
|
+
const isPreloaded = props.state.preloadedRoutes.includes(route);
|
|
136
|
+
const previousRoute = isPreloaded ? undefined : self[index - 1];
|
|
137
|
+
const nextRoute = isPreloaded ? undefined : self[index + 1];
|
|
100
138
|
const oldScene = state.scenes[index];
|
|
101
139
|
const currentGesture = gestures[route.key];
|
|
102
140
|
const previousGesture = previousRoute ? gestures[previousRoute.key] : undefined;
|
|
103
141
|
const nextGesture = nextRoute ? gestures[nextRoute.key] : undefined;
|
|
104
|
-
const descriptor = props.descriptors[route.key] || state.descriptors[route.key] || (oldScene ? oldScene.descriptor : FALLBACK_DESCRIPTOR);
|
|
105
|
-
const
|
|
106
|
-
const
|
|
142
|
+
const descriptor = (isPreloaded ? props.preloadedDescriptors : props.descriptors)[route.key] || state.descriptors[route.key] || (oldScene ? oldScene.descriptor : FALLBACK_DESCRIPTOR);
|
|
143
|
+
const nextOptions = nextRoute && (props.descriptors[nextRoute?.key] || state.descriptors[nextRoute?.key])?.options;
|
|
144
|
+
const previousOptions = previousRoute && (props.descriptors[previousRoute?.key] || state.descriptors[previousRoute?.key])?.options;
|
|
107
145
|
|
|
108
146
|
// When a screen is not the last, it should use next screen's transition config
|
|
109
147
|
// Many transitions also animate the previous screen, so using 2 different transitions doesn't look right
|
|
110
148
|
// For example combining a slide and a modal transition would look wrong otherwise
|
|
111
149
|
// With this approach, combining different transition styles in the same navigator mostly looks right
|
|
112
150
|
// This will still be broken when 2 transitions have different idle state (e.g. modal presentation),
|
|
113
|
-
// but majority of the transitions look alright
|
|
114
|
-
const optionsForTransitionConfig = index !== self.length - 1 &&
|
|
115
|
-
|
|
151
|
+
// but the majority of the transitions look alright
|
|
152
|
+
const optionsForTransitionConfig = index !== self.length - 1 && nextOptions && nextOptions?.presentation !== 'transparentModal' ? nextOptions : descriptor.options;
|
|
153
|
+
|
|
154
|
+
// Assume modal if there are already modal screens in the stack
|
|
155
|
+
// or current screen is a modal when no presentation is specified
|
|
156
|
+
const isModal = modalRouteKeys.includes(route.key);
|
|
157
|
+
const animation = getDefaultAnimation(optionsForTransitionConfig.animation);
|
|
158
|
+
const isAnimationEnabled = getAnimationEnabled(animation);
|
|
159
|
+
const transitionPreset = animation !== 'default' ? NAMED_TRANSITIONS_PRESETS[animation] : optionsForTransitionConfig.presentation === 'transparentModal' ? ModalFadeTransition : optionsForTransitionConfig.presentation === 'modal' || isModal ? ModalTransition : DefaultTransition;
|
|
116
160
|
const {
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
headerStyleInterpolator = defaultTransitionPreset.headerStyleInterpolator,
|
|
161
|
+
gestureEnabled = Platform.OS === 'ios' && isAnimationEnabled,
|
|
162
|
+
gestureDirection = transitionPreset.gestureDirection,
|
|
163
|
+
transitionSpec = transitionPreset.transitionSpec,
|
|
164
|
+
cardStyleInterpolator = isAnimationEnabled ? transitionPreset.cardStyleInterpolator : forNoAnimationCard,
|
|
165
|
+
headerStyleInterpolator = transitionPreset.headerStyleInterpolator,
|
|
123
166
|
cardOverlayEnabled = Platform.OS !== 'ios' && optionsForTransitionConfig.presentation !== 'transparentModal' || getIsModalPresentation(cardStyleInterpolator)
|
|
124
167
|
} = optionsForTransitionConfig;
|
|
125
|
-
const headerMode = descriptor.options.headerMode ?? (!(optionsForTransitionConfig.presentation === 'modal' || optionsForTransitionConfig.presentation === 'transparentModal' ||
|
|
168
|
+
const headerMode = descriptor.options.headerMode ?? (!(optionsForTransitionConfig.presentation === 'modal' || optionsForTransitionConfig.presentation === 'transparentModal' || nextOptions?.presentation === 'modal' || nextOptions?.presentation === 'transparentModal' || getIsModalPresentation(cardStyleInterpolator)) && Platform.OS === 'ios' && descriptor.options.header === undefined ? 'float' : 'screen');
|
|
169
|
+
const isRTL = props.direction === 'rtl';
|
|
126
170
|
const scene = {
|
|
127
171
|
route,
|
|
128
172
|
descriptor: {
|
|
129
173
|
...descriptor,
|
|
130
174
|
options: {
|
|
131
175
|
...descriptor.options,
|
|
132
|
-
|
|
176
|
+
animation,
|
|
133
177
|
cardOverlayEnabled,
|
|
134
178
|
cardStyleInterpolator,
|
|
135
179
|
gestureDirection,
|
|
@@ -140,11 +184,11 @@ export default class CardStack extends React.Component {
|
|
|
140
184
|
}
|
|
141
185
|
},
|
|
142
186
|
progress: {
|
|
143
|
-
current: getProgressFromGesture(currentGesture, state.layout, descriptor),
|
|
144
|
-
next: nextGesture &&
|
|
145
|
-
previous: previousGesture ? getProgressFromGesture(previousGesture, state.layout,
|
|
187
|
+
current: getProgressFromGesture(currentGesture, state.layout, descriptor.options, isRTL),
|
|
188
|
+
next: nextGesture && nextOptions?.presentation !== 'transparentModal' ? getProgressFromGesture(nextGesture, state.layout, nextOptions, isRTL) : undefined,
|
|
189
|
+
previous: previousGesture ? getProgressFromGesture(previousGesture, state.layout, previousOptions, isRTL) : undefined
|
|
146
190
|
},
|
|
147
|
-
__memo: [state.layout, descriptor,
|
|
191
|
+
__memo: [state.layout, descriptor, nextOptions, previousOptions, currentGesture, nextGesture, previousGesture]
|
|
148
192
|
};
|
|
149
193
|
if (oldScene && scene.__memo.every((it, i) => {
|
|
150
194
|
// @ts-expect-error: we haven't added __memo to the annotation to prevent usage elsewhere
|
|
@@ -154,11 +198,70 @@ export default class CardStack extends React.Component {
|
|
|
154
198
|
}
|
|
155
199
|
return scene;
|
|
156
200
|
});
|
|
201
|
+
let activeStates = state.activeStates;
|
|
202
|
+
if (props.routes.length !== state.routes.length) {
|
|
203
|
+
// amznmod_react - change activeScreensLimit from 1 to 2
|
|
204
|
+
// Increase activeScreensLimit to prevent detaching the screen underneath
|
|
205
|
+
// When performing a pop animation, the screen underneath is inactive and has to by mounted
|
|
206
|
+
// This takes a long time and results with a noticeable delay when navigating between screens
|
|
207
|
+
// @ts-ignore - accept kepler as a platform
|
|
208
|
+
let activeScreensLimit = Platform.OS === 'kepler' ? 2 : 1;
|
|
209
|
+
for (let i = props.routes.length - 1; i >= 0; i--) {
|
|
210
|
+
const {
|
|
211
|
+
options
|
|
212
|
+
} = scenes[i].descriptor;
|
|
213
|
+
const {
|
|
214
|
+
// By default, we don't want to detach the previous screen of the active one for modals
|
|
215
|
+
detachPreviousScreen = options.presentation === 'transparentModal' ? false : getIsModalPresentation(options.cardStyleInterpolator) ? i !== findLastIndex(scenes, scene => {
|
|
216
|
+
const {
|
|
217
|
+
cardStyleInterpolator
|
|
218
|
+
} = scene.descriptor.options;
|
|
219
|
+
return cardStyleInterpolator === forModalPresentationIOS || cardStyleInterpolator?.name === 'forModalPresentationIOS';
|
|
220
|
+
}) : true
|
|
221
|
+
} = options;
|
|
222
|
+
if (detachPreviousScreen === false) {
|
|
223
|
+
activeScreensLimit++;
|
|
224
|
+
} else {
|
|
225
|
+
// Check at least last 2 screens before stopping
|
|
226
|
+
// This will make sure that screen isn't detached when another screen is animating on top of the transparent one
|
|
227
|
+
// e.g. opaque -> transparent -> opaque
|
|
228
|
+
if (i <= props.routes.length - 2) {
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
activeStates = props.routes.map((_, index, self) => {
|
|
234
|
+
// The activity state represents state of the screen:
|
|
235
|
+
// 0 - inactive, the screen is detached
|
|
236
|
+
// 1 - transitioning or below the top screen, the screen is mounted but interaction is disabled
|
|
237
|
+
// 2 - on top of the stack, the screen is mounted and interaction is enabled
|
|
238
|
+
let activityState;
|
|
239
|
+
const lastActiveState = state.activeStates[index];
|
|
240
|
+
const activeAfterTransition = index >= self.length - activeScreensLimit;
|
|
241
|
+
if (lastActiveState === STATE_INACTIVE && !activeAfterTransition) {
|
|
242
|
+
// screen was inactive before and it will still be inactive after the transition
|
|
243
|
+
activityState = STATE_INACTIVE;
|
|
244
|
+
} else {
|
|
245
|
+
const sceneForActivity = scenes[self.length - 1];
|
|
246
|
+
const outputValue = index === self.length - 1 ? STATE_ON_TOP // the screen is on top after the transition
|
|
247
|
+
: activeAfterTransition ? STATE_TRANSITIONING_OR_BELOW_TOP // the screen should stay active after the transition, it is not on top but is in activeLimit
|
|
248
|
+
: STATE_INACTIVE; // the screen should be active only during the transition, it is at the edge of activeLimit
|
|
249
|
+
|
|
250
|
+
activityState = sceneForActivity ? sceneForActivity.progress.current.interpolate({
|
|
251
|
+
inputRange: [0, 1 - EPSILON, 1],
|
|
252
|
+
outputRange: [1, 1, outputValue],
|
|
253
|
+
extrapolate: 'clamp'
|
|
254
|
+
}) : STATE_TRANSITIONING_OR_BELOW_TOP;
|
|
255
|
+
}
|
|
256
|
+
return activityState;
|
|
257
|
+
});
|
|
258
|
+
}
|
|
157
259
|
return {
|
|
158
260
|
routes: props.routes,
|
|
159
261
|
scenes,
|
|
160
262
|
gestures,
|
|
161
263
|
descriptors: props.descriptors,
|
|
264
|
+
activeStates,
|
|
162
265
|
headerHeights: getHeaderHeights(scenes, props.insets, props.isParentHeaderShown, props.isParentModal, state.layout, state.headerHeights)
|
|
163
266
|
};
|
|
164
267
|
}
|
|
@@ -170,6 +273,7 @@ export default class CardStack extends React.Component {
|
|
|
170
273
|
gestures: {},
|
|
171
274
|
layout: SafeAreaProviderCompat.initialMetrics.frame,
|
|
172
275
|
descriptors: this.props.descriptors,
|
|
276
|
+
activeStates: [],
|
|
173
277
|
// Used when card's header is null and mode is float to make transition
|
|
174
278
|
// between screens with headers and those without headers smooth.
|
|
175
279
|
// This is not a great heuristic here. We don't know synchronously
|
|
@@ -245,11 +349,11 @@ export default class CardStack extends React.Component {
|
|
|
245
349
|
insets,
|
|
246
350
|
state,
|
|
247
351
|
routes,
|
|
352
|
+
openingRouteKeys,
|
|
248
353
|
closingRouteKeys,
|
|
249
354
|
onOpenRoute,
|
|
250
355
|
onCloseRoute,
|
|
251
356
|
renderHeader,
|
|
252
|
-
renderScene,
|
|
253
357
|
isParentHeaderShown,
|
|
254
358
|
isParentModal,
|
|
255
359
|
onTransitionStart,
|
|
@@ -258,14 +362,14 @@ export default class CardStack extends React.Component {
|
|
|
258
362
|
onGestureEnd,
|
|
259
363
|
onGestureCancel,
|
|
260
364
|
detachInactiveScreens = Platform.OS === 'web' || Platform.OS === 'android' || Platform.OS === 'ios' ||
|
|
261
|
-
//
|
|
262
|
-
//@ts-ignore
|
|
365
|
+
// @ts-ignore - accept kepler as a platform
|
|
263
366
|
Platform.OS === 'kepler'
|
|
264
367
|
} = this.props;
|
|
265
368
|
const {
|
|
266
369
|
scenes,
|
|
267
370
|
layout,
|
|
268
371
|
gestures,
|
|
372
|
+
activeStates,
|
|
269
373
|
headerHeights
|
|
270
374
|
} = this.state;
|
|
271
375
|
const focusedRoute = state.routes[state.index];
|
|
@@ -282,138 +386,99 @@ export default class CardStack extends React.Component {
|
|
|
282
386
|
}
|
|
283
387
|
return false;
|
|
284
388
|
});
|
|
285
|
-
|
|
286
|
-
for (let i = scenes.length - 1; i >= 0; i--) {
|
|
287
|
-
const {
|
|
288
|
-
options
|
|
289
|
-
} = scenes[i].descriptor;
|
|
290
|
-
const {
|
|
291
|
-
// By default, we don't want to detach the previous screen of the active one for modals
|
|
292
|
-
detachPreviousScreen = options.presentation === 'transparentModal' ? false : getIsModalPresentation(options.cardStyleInterpolator) ? i !== findLastIndex(scenes, scene => {
|
|
293
|
-
const {
|
|
294
|
-
cardStyleInterpolator
|
|
295
|
-
} = scene.descriptor.options;
|
|
296
|
-
return cardStyleInterpolator === forModalPresentationIOS || (cardStyleInterpolator === null || cardStyleInterpolator === void 0 ? void 0 : cardStyleInterpolator.name) === 'forModalPresentationIOS';
|
|
297
|
-
}) : true
|
|
298
|
-
} = options;
|
|
299
|
-
if (detachPreviousScreen === false) {
|
|
300
|
-
activeScreensLimit++;
|
|
301
|
-
} else {
|
|
302
|
-
// Check at least last 2 screens before stopping
|
|
303
|
-
// This will make sure that screen isn't detached when another screen is animating on top of the transparent one
|
|
304
|
-
// For example, (Opaque -> Transparent -> Opaque)
|
|
305
|
-
if (i <= scenes.length - 2) {
|
|
306
|
-
break;
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
const floatingHeader = /*#__PURE__*/React.createElement(React.Fragment, {
|
|
311
|
-
key: "header"
|
|
312
|
-
}, renderHeader({
|
|
313
|
-
mode: 'float',
|
|
314
|
-
layout,
|
|
315
|
-
scenes,
|
|
316
|
-
getPreviousScene: this.getPreviousScene,
|
|
317
|
-
getFocusedRoute: this.getFocusedRoute,
|
|
318
|
-
onContentHeightChange: this.handleHeaderLayout,
|
|
319
|
-
style: [styles.floating, isFloatHeaderAbsolute && [
|
|
320
|
-
// Without this, the header buttons won't be touchable on Android when headerTransparent: true
|
|
321
|
-
{
|
|
322
|
-
height: focusedHeaderHeight
|
|
323
|
-
}, styles.absolute]]
|
|
324
|
-
}));
|
|
325
|
-
return /*#__PURE__*/React.createElement(Background, null, isFloatHeaderAbsolute ? null : floatingHeader, /*#__PURE__*/React.createElement(MaybeScreenContainer, {
|
|
326
|
-
enabled: detachInactiveScreens,
|
|
389
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
327
390
|
style: styles.container,
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
const gesture = gestures[route.key];
|
|
333
|
-
const scene = scenes[index];
|
|
334
|
-
|
|
335
|
-
// For the screens that shouldn't be active, the value is 0
|
|
336
|
-
// For those that should be active, but are not the top screen, the value is 1
|
|
337
|
-
// For those on top of the stack and with interaction enabled, the value is 2
|
|
338
|
-
// For the old implementation, it stays the same it was
|
|
339
|
-
let isScreenActive = 1;
|
|
340
|
-
|
|
341
|
-
//amznmod_react - Fix off-by-one error in activity state calculation to prevent multiple screens from having same state
|
|
342
|
-
if (index < self.length - activeScreensLimit) {
|
|
343
|
-
isScreenActive = STATE_INACTIVE;
|
|
344
|
-
} else {
|
|
345
|
-
isScreenActive = STATE_TRANSITIONING_OR_BELOW_TOP;
|
|
346
|
-
}
|
|
347
|
-
const {
|
|
348
|
-
headerShown = true,
|
|
349
|
-
headerTransparent,
|
|
350
|
-
headerStyle,
|
|
351
|
-
headerTintColor,
|
|
352
|
-
freezeOnBlur
|
|
353
|
-
} = scene.descriptor.options;
|
|
354
|
-
const safeAreaInsetTop = insets.top;
|
|
355
|
-
const safeAreaInsetRight = insets.right;
|
|
356
|
-
const safeAreaInsetBottom = insets.bottom;
|
|
357
|
-
const safeAreaInsetLeft = insets.left;
|
|
358
|
-
const headerHeight = headerShown !== false ? headerHeights[route.key] : 0;
|
|
359
|
-
let headerDarkContent;
|
|
360
|
-
if (headerShown) {
|
|
361
|
-
if (typeof headerTintColor === 'string') {
|
|
362
|
-
headerDarkContent = Color(headerTintColor).isDark();
|
|
363
|
-
} else {
|
|
364
|
-
const flattenedHeaderStyle = StyleSheet.flatten(headerStyle);
|
|
365
|
-
if (flattenedHeaderStyle && 'backgroundColor' in flattenedHeaderStyle && typeof flattenedHeaderStyle.backgroundColor === 'string') {
|
|
366
|
-
headerDarkContent = !Color(flattenedHeaderStyle.backgroundColor).isDark();
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
// Start from current card and count backwards the number of cards with same interpolation
|
|
372
|
-
const interpolationIndex = getInterpolationIndex(scenes, index);
|
|
373
|
-
const isModal = getIsModal(scene, interpolationIndex, isParentModal);
|
|
374
|
-
const isNextScreenTransparent = ((_scenes = scenes[index + 1]) === null || _scenes === void 0 ? void 0 : _scenes.descriptor.options.presentation) === 'transparentModal';
|
|
375
|
-
const detachCurrentScreen = ((_scenes2 = scenes[index + 1]) === null || _scenes2 === void 0 ? void 0 : _scenes2.descriptor.options.detachPreviousScreen) !== false;
|
|
376
|
-
return /*#__PURE__*/React.createElement(MaybeScreen, {
|
|
377
|
-
key: route.key,
|
|
378
|
-
style: StyleSheet.absoluteFill,
|
|
379
|
-
enabled: detachInactiveScreens,
|
|
380
|
-
active: isScreenActive,
|
|
381
|
-
freezeOnBlur: freezeOnBlur,
|
|
382
|
-
pointerEvents: "box-none"
|
|
383
|
-
}, /*#__PURE__*/React.createElement(CardContainer, {
|
|
384
|
-
index: index,
|
|
385
|
-
interpolationIndex: interpolationIndex,
|
|
386
|
-
modal: isModal,
|
|
387
|
-
active: index === self.length - 1,
|
|
388
|
-
focused: focused,
|
|
389
|
-
closing: closingRouteKeys.includes(route.key),
|
|
390
|
-
layout: layout,
|
|
391
|
-
gesture: gesture,
|
|
392
|
-
scene: scene,
|
|
393
|
-
safeAreaInsetTop: safeAreaInsetTop,
|
|
394
|
-
safeAreaInsetRight: safeAreaInsetRight,
|
|
395
|
-
safeAreaInsetBottom: safeAreaInsetBottom,
|
|
396
|
-
safeAreaInsetLeft: safeAreaInsetLeft,
|
|
397
|
-
onGestureStart: onGestureStart,
|
|
398
|
-
onGestureCancel: onGestureCancel,
|
|
399
|
-
onGestureEnd: onGestureEnd,
|
|
400
|
-
headerHeight: headerHeight,
|
|
401
|
-
isParentHeaderShown: isParentHeaderShown,
|
|
402
|
-
onHeaderHeightChange: this.handleHeaderLayout,
|
|
391
|
+
children: [renderHeader({
|
|
392
|
+
mode: 'float',
|
|
393
|
+
layout,
|
|
394
|
+
scenes,
|
|
403
395
|
getPreviousScene: this.getPreviousScene,
|
|
404
396
|
getFocusedRoute: this.getFocusedRoute,
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
397
|
+
onContentHeightChange: this.handleHeaderLayout,
|
|
398
|
+
style: [styles.floating, isFloatHeaderAbsolute && [
|
|
399
|
+
// Without this, the header buttons won't be touchable on Android when headerTransparent: true
|
|
400
|
+
{
|
|
401
|
+
height: focusedHeaderHeight
|
|
402
|
+
}, styles.absolute]]
|
|
403
|
+
}), /*#__PURE__*/_jsx(MaybeScreenContainer, {
|
|
404
|
+
enabled: detachInactiveScreens,
|
|
405
|
+
style: styles.container,
|
|
406
|
+
onLayout: this.handleLayout,
|
|
407
|
+
children: [...routes, ...state.preloadedRoutes].map((route, index) => {
|
|
408
|
+
const focused = focusedRoute.key === route.key;
|
|
409
|
+
const gesture = gestures[route.key];
|
|
410
|
+
const scene = scenes[index];
|
|
411
|
+
// It is possible that for a short period the route appears in both arrays.
|
|
412
|
+
// Particularly, if the screen is removed with `retain`, then it needs a moment to execute the animation.
|
|
413
|
+
// However, due to the router action, it immediately populates the `preloadedRoutes` array.
|
|
414
|
+
// Practically, the logic below takes care that it is rendered only once.
|
|
415
|
+
const isPreloaded = state.preloadedRoutes.includes(route) && !routes.includes(route);
|
|
416
|
+
if (state.preloadedRoutes.includes(route) && routes.includes(route) && index >= routes.length) {
|
|
417
|
+
return null;
|
|
418
|
+
}
|
|
419
|
+
const {
|
|
420
|
+
headerShown = true,
|
|
421
|
+
headerTransparent,
|
|
422
|
+
freezeOnBlur,
|
|
423
|
+
autoHideHomeIndicator
|
|
424
|
+
} = scene.descriptor.options;
|
|
425
|
+
const safeAreaInsetTop = insets.top;
|
|
426
|
+
const safeAreaInsetRight = insets.right;
|
|
427
|
+
const safeAreaInsetBottom = insets.bottom;
|
|
428
|
+
const safeAreaInsetLeft = insets.left;
|
|
429
|
+
const headerHeight = headerShown !== false ? headerHeights[route.key] : 0;
|
|
430
|
+
|
|
431
|
+
// Start from current card and count backwards the number of cards with same interpolation
|
|
432
|
+
const interpolationIndex = getInterpolationIndex(scenes, index);
|
|
433
|
+
const isModal = getIsModal(scene, interpolationIndex, isParentModal);
|
|
434
|
+
const isNextScreenTransparent = scenes[index + 1]?.descriptor.options.presentation === 'transparentModal';
|
|
435
|
+
const detachCurrentScreen = scenes[index + 1]?.descriptor.options.detachPreviousScreen !== false;
|
|
436
|
+
const activityState = isPreloaded ? STATE_INACTIVE : activeStates[index];
|
|
437
|
+
return /*#__PURE__*/_jsx(MaybeScreen, {
|
|
438
|
+
style: [StyleSheet.absoluteFill],
|
|
439
|
+
enabled: detachInactiveScreens,
|
|
440
|
+
active: activityState,
|
|
441
|
+
freezeOnBlur: freezeOnBlur,
|
|
442
|
+
shouldFreeze: activityState === STATE_INACTIVE && !isPreloaded,
|
|
443
|
+
homeIndicatorHidden: autoHideHomeIndicator,
|
|
444
|
+
pointerEvents: "box-none",
|
|
445
|
+
children: /*#__PURE__*/_jsx(CardContainer, {
|
|
446
|
+
index: index,
|
|
447
|
+
interpolationIndex: interpolationIndex,
|
|
448
|
+
modal: isModal,
|
|
449
|
+
active: index === routes.length - 1,
|
|
450
|
+
focused: focused,
|
|
451
|
+
opening: openingRouteKeys.includes(route.key),
|
|
452
|
+
closing: closingRouteKeys.includes(route.key),
|
|
453
|
+
layout: layout,
|
|
454
|
+
gesture: gesture,
|
|
455
|
+
scene: scene,
|
|
456
|
+
safeAreaInsetTop: safeAreaInsetTop,
|
|
457
|
+
safeAreaInsetRight: safeAreaInsetRight,
|
|
458
|
+
safeAreaInsetBottom: safeAreaInsetBottom,
|
|
459
|
+
safeAreaInsetLeft: safeAreaInsetLeft,
|
|
460
|
+
onGestureStart: onGestureStart,
|
|
461
|
+
onGestureCancel: onGestureCancel,
|
|
462
|
+
onGestureEnd: onGestureEnd,
|
|
463
|
+
headerHeight: headerHeight,
|
|
464
|
+
isParentHeaderShown: isParentHeaderShown,
|
|
465
|
+
onHeaderHeightChange: this.handleHeaderLayout,
|
|
466
|
+
getPreviousScene: this.getPreviousScene,
|
|
467
|
+
getFocusedRoute: this.getFocusedRoute,
|
|
468
|
+
hasAbsoluteFloatHeader: isFloatHeaderAbsolute && !headerTransparent,
|
|
469
|
+
renderHeader: renderHeader,
|
|
470
|
+
onOpenRoute: onOpenRoute,
|
|
471
|
+
onCloseRoute: onCloseRoute,
|
|
472
|
+
onTransitionStart: onTransitionStart,
|
|
473
|
+
onTransitionEnd: onTransitionEnd,
|
|
474
|
+
isNextScreenTransparent: isNextScreenTransparent,
|
|
475
|
+
detachCurrentScreen: detachCurrentScreen,
|
|
476
|
+
preloaded: isPreloaded
|
|
477
|
+
})
|
|
478
|
+
}, route.key);
|
|
479
|
+
})
|
|
480
|
+
})]
|
|
481
|
+
});
|
|
417
482
|
}
|
|
418
483
|
}
|
|
419
484
|
const styles = StyleSheet.create({
|
|
@@ -423,8 +488,8 @@ const styles = StyleSheet.create({
|
|
|
423
488
|
absolute: {
|
|
424
489
|
position: 'absolute',
|
|
425
490
|
top: 0,
|
|
426
|
-
|
|
427
|
-
|
|
491
|
+
start: 0,
|
|
492
|
+
end: 0
|
|
428
493
|
},
|
|
429
494
|
floating: {
|
|
430
495
|
zIndex: 1
|