@react-navigation/stack 7.0.0-rc.2 → 7.0.0-rc.21
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/lib/commonjs/TransitionConfigs/CardStyleInterpolators.js +1 -1
- package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js +2 -1
- package/lib/commonjs/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
- package/lib/commonjs/TransitionConfigs/TransitionPresets.js +3 -3
- package/lib/commonjs/index.js +11 -11
- package/lib/commonjs/navigators/createStackNavigator.js +12 -9
- package/lib/commonjs/navigators/createStackNavigator.js.map +1 -1
- package/lib/commonjs/package.json +1 -0
- package/lib/commonjs/utils/getDistanceForDirection.js +1 -1
- package/lib/commonjs/utils/useCardAnimation.js +1 -1
- package/lib/commonjs/utils/useGestureHandlerRef.js +1 -1
- package/lib/commonjs/views/GestureHandler.android.js +1 -1
- package/lib/commonjs/views/GestureHandler.ios.js +1 -1
- package/lib/commonjs/views/GestureHandler.js +4 -1
- package/lib/commonjs/views/GestureHandler.js.map +1 -1
- package/lib/commonjs/views/GestureHandlerNative.js +9 -7
- package/lib/commonjs/views/GestureHandlerNative.js.map +1 -1
- package/lib/commonjs/views/Header/Header.js +7 -6
- package/lib/commonjs/views/Header/Header.js.map +1 -1
- package/lib/commonjs/views/Header/HeaderContainer.js +94 -88
- package/lib/commonjs/views/Header/HeaderContainer.js.map +1 -1
- package/lib/commonjs/views/Header/HeaderSegment.js +16 -12
- package/lib/commonjs/views/Header/HeaderSegment.js.map +1 -1
- package/lib/commonjs/views/Screens.js +15 -9
- package/lib/commonjs/views/Screens.js.map +1 -1
- package/lib/commonjs/views/Stack/Card.js +410 -370
- package/lib/commonjs/views/Stack/Card.js.map +1 -1
- package/lib/commonjs/views/Stack/CardContainer.js +33 -25
- package/lib/commonjs/views/Stack/CardContainer.js.map +1 -1
- package/lib/commonjs/views/Stack/CardSheet.js +17 -13
- package/lib/commonjs/views/Stack/CardSheet.js.map +1 -1
- package/lib/commonjs/views/Stack/CardStack.js +355 -330
- package/lib/commonjs/views/Stack/CardStack.js.map +1 -1
- package/lib/commonjs/views/Stack/StackView.js +323 -287
- package/lib/commonjs/views/Stack/StackView.js.map +1 -1
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js +3 -1
- package/lib/module/TransitionConfigs/CardStyleInterpolators.js.map +1 -1
- package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js +4 -1
- package/lib/module/TransitionConfigs/HeaderStyleInterpolators.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionPresets.js +5 -3
- package/lib/module/TransitionConfigs/TransitionPresets.js.map +1 -1
- package/lib/module/TransitionConfigs/TransitionSpecs.js +2 -0
- 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 +14 -9
- 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/utils/CardAnimationContext.js +2 -0
- package/lib/module/utils/CardAnimationContext.js.map +1 -1
- package/lib/module/utils/GestureHandlerRefContext.js +2 -0
- package/lib/module/utils/GestureHandlerRefContext.js.map +1 -1
- package/lib/module/utils/ModalPresentationContext.js +2 -0
- package/lib/module/utils/ModalPresentationContext.js.map +1 -1
- package/lib/module/utils/conditional.js +2 -0
- package/lib/module/utils/conditional.js.map +1 -1
- package/lib/module/utils/findLastIndex.js +2 -0
- package/lib/module/utils/findLastIndex.js.map +1 -1
- package/lib/module/utils/getDistanceForDirection.js +3 -1
- package/lib/module/utils/getDistanceForDirection.js.map +1 -1
- package/lib/module/utils/getInvertedMultiplier.js +2 -0
- package/lib/module/utils/getInvertedMultiplier.js.map +1 -1
- package/lib/module/utils/getModalRoutesKeys.js +2 -0
- package/lib/module/utils/getModalRoutesKeys.js.map +1 -1
- package/lib/module/utils/memoize.js +2 -0
- package/lib/module/utils/memoize.js.map +1 -1
- package/lib/module/utils/throttle.js +2 -0
- package/lib/module/utils/throttle.js.map +1 -1
- package/lib/module/utils/useCardAnimation.js +3 -1
- package/lib/module/utils/useCardAnimation.js.map +1 -1
- package/lib/module/utils/useGestureHandlerRef.js +3 -1
- package/lib/module/utils/useGestureHandlerRef.js.map +1 -1
- package/lib/module/utils/useKeyboardManager.js +2 -0
- 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/GestureHandlerNative.js +11 -7
- package/lib/module/views/GestureHandlerNative.js.map +1 -1
- package/lib/module/views/Header/Header.js +9 -6
- package/lib/module/views/Header/Header.js.map +1 -1
- package/lib/module/views/Header/HeaderContainer.js +96 -88
- package/lib/module/views/Header/HeaderContainer.js.map +1 -1
- package/lib/module/views/Header/HeaderSegment.js +18 -12
- 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 +412 -369
- package/lib/module/views/Stack/Card.js.map +1 -1
- package/lib/module/views/Stack/CardContainer.js +35 -25
- package/lib/module/views/Stack/CardContainer.js.map +1 -1
- package/lib/module/views/Stack/CardSheet.js +19 -13
- package/lib/module/views/Stack/CardSheet.js.map +1 -1
- package/lib/module/views/Stack/CardStack.js +357 -329
- package/lib/module/views/Stack/CardStack.js.map +1 -1
- package/lib/module/views/Stack/StackView.js +325 -286
- package/lib/module/views/Stack/StackView.js.map +1 -1
- package/lib/typescript/commonjs/package.json +1 -0
- package/lib/typescript/commonjs/src/TransitionConfigs/CardStyleInterpolators.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TransitionConfigs/HeaderStyleInterpolators.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TransitionConfigs/TransitionPresets.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/TransitionConfigs/TransitionSpecs.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/index.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/navigators/createStackNavigator.d.ts +3 -4
- package/lib/typescript/commonjs/src/navigators/createStackNavigator.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/types.d.ts +17 -9
- package/lib/typescript/commonjs/src/types.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/CardAnimationContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/GestureHandlerRefContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/ModalPresentationContext.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/conditional.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/findLastIndex.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/getDistanceForDirection.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/getInvertedMultiplier.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/getModalRoutesKeys.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/memoize.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/throttle.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/useCardAnimation.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/useGestureHandlerRef.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/utils/useKeyboardManager.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/views/GestureHandler.android.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/views/GestureHandler.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/views/GestureHandler.ios.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/views/GestureHandlerNative.d.ts +1 -2
- package/lib/typescript/commonjs/src/views/GestureHandlerNative.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/views/Header/Header.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/views/Header/HeaderContainer.d.ts +1 -2
- package/lib/typescript/commonjs/src/views/Header/HeaderContainer.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/views/Header/HeaderSegment.d.ts +1 -2
- package/lib/typescript/commonjs/src/views/Header/HeaderSegment.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/views/Screens.d.ts +2 -2
- package/lib/typescript/commonjs/src/views/Screens.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/views/Stack/Card.d.ts +2 -2
- package/lib/typescript/commonjs/src/views/Stack/Card.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/views/Stack/CardContainer.d.ts +1 -1
- package/lib/typescript/commonjs/src/views/Stack/CardContainer.d.ts.map +1 -0
- package/lib/typescript/commonjs/src/views/Stack/CardSheet.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/views/Stack/CardStack.d.ts +1 -1
- package/lib/typescript/commonjs/src/views/Stack/CardStack.d.ts.map +1 -0
- package/lib/typescript/{src → commonjs/src}/views/Stack/StackView.d.ts +1 -1
- package/lib/typescript/commonjs/src/views/Stack/StackView.d.ts.map +1 -0
- package/lib/typescript/commonjs/tsconfig.build.tsbuildinfo +1 -0
- package/lib/typescript/module/package.json +1 -0
- package/lib/typescript/module/src/TransitionConfigs/CardStyleInterpolators.d.ts +43 -0
- package/lib/typescript/module/src/TransitionConfigs/CardStyleInterpolators.d.ts.map +1 -0
- package/lib/typescript/module/src/TransitionConfigs/HeaderStyleInterpolators.d.ts +23 -0
- package/lib/typescript/module/src/TransitionConfigs/HeaderStyleInterpolators.d.ts.map +1 -0
- package/lib/typescript/module/src/TransitionConfigs/TransitionPresets.d.ts +50 -0
- package/lib/typescript/module/src/TransitionConfigs/TransitionPresets.d.ts.map +1 -0
- package/lib/typescript/module/src/TransitionConfigs/TransitionSpecs.d.ts +46 -0
- package/lib/typescript/module/src/TransitionConfigs/TransitionSpecs.d.ts.map +1 -0
- package/lib/typescript/module/src/index.d.ts +29 -0
- package/lib/typescript/module/src/index.d.ts.map +1 -0
- package/lib/typescript/module/src/navigators/createStackNavigator.d.ts +17 -0
- package/lib/typescript/module/src/navigators/createStackNavigator.d.ts.map +1 -0
- package/lib/typescript/module/src/types.d.ts +544 -0
- package/lib/typescript/module/src/types.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/CardAnimationContext.d.ts +4 -0
- package/lib/typescript/module/src/utils/CardAnimationContext.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/GestureHandlerRefContext.d.ts +3 -0
- package/lib/typescript/module/src/utils/GestureHandlerRefContext.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/ModalPresentationContext.d.ts +3 -0
- package/lib/typescript/module/src/utils/ModalPresentationContext.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/conditional.d.ts +10 -0
- package/lib/typescript/module/src/utils/conditional.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/findLastIndex.d.ts +2 -0
- package/lib/typescript/module/src/utils/findLastIndex.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/getDistanceForDirection.d.ts +3 -0
- package/lib/typescript/module/src/utils/getDistanceForDirection.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/getInvertedMultiplier.d.ts +3 -0
- package/lib/typescript/module/src/utils/getInvertedMultiplier.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/getModalRoutesKeys.d.ts +4 -0
- package/lib/typescript/module/src/utils/getModalRoutesKeys.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/memoize.d.ts +2 -0
- package/lib/typescript/module/src/utils/memoize.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/throttle.d.ts +2 -0
- package/lib/typescript/module/src/utils/throttle.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/useCardAnimation.d.ts +2 -0
- package/lib/typescript/module/src/utils/useCardAnimation.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/useGestureHandlerRef.d.ts +3 -0
- package/lib/typescript/module/src/utils/useGestureHandlerRef.d.ts.map +1 -0
- package/lib/typescript/module/src/utils/useKeyboardManager.d.ts +6 -0
- package/lib/typescript/module/src/utils/useKeyboardManager.d.ts.map +1 -0
- package/lib/typescript/module/src/views/GestureHandler.android.d.ts +2 -0
- package/lib/typescript/module/src/views/GestureHandler.android.d.ts.map +1 -0
- package/lib/typescript/module/src/views/GestureHandler.d.ts +15 -0
- package/lib/typescript/module/src/views/GestureHandler.d.ts.map +1 -0
- package/lib/typescript/module/src/views/GestureHandler.ios.d.ts +2 -0
- package/lib/typescript/module/src/views/GestureHandler.ios.d.ts.map +1 -0
- package/lib/typescript/module/src/views/GestureHandlerNative.d.ts +5 -0
- package/lib/typescript/module/src/views/GestureHandlerNative.d.ts.map +1 -0
- package/lib/typescript/module/src/views/Header/Header.d.ts +4 -0
- package/lib/typescript/module/src/views/Header/Header.d.ts.map +1 -0
- package/lib/typescript/module/src/views/Header/HeaderContainer.d.ts +19 -0
- package/lib/typescript/module/src/views/Header/HeaderContainer.d.ts.map +1 -0
- package/lib/typescript/module/src/views/Header/HeaderSegment.d.ts +14 -0
- package/lib/typescript/module/src/views/Header/HeaderSegment.d.ts.map +1 -0
- package/lib/typescript/module/src/views/Screens.d.ts +14 -0
- package/lib/typescript/module/src/views/Screens.d.ts.map +1 -0
- package/lib/typescript/module/src/views/Stack/Card.d.ts +77 -0
- package/lib/typescript/module/src/views/Stack/Card.d.ts.map +1 -0
- package/lib/typescript/module/src/views/Stack/CardContainer.d.ts +60 -0
- package/lib/typescript/module/src/views/Stack/CardContainer.d.ts.map +1 -0
- package/lib/typescript/module/src/views/Stack/CardSheet.d.ts +14 -0
- package/lib/typescript/module/src/views/Stack/CardSheet.d.ts.map +1 -0
- package/lib/typescript/module/src/views/Stack/CardStack.d.ts +66 -0
- package/lib/typescript/module/src/views/Stack/CardStack.d.ts.map +1 -0
- package/lib/typescript/module/src/views/Stack/StackView.d.ts +51 -0
- package/lib/typescript/module/src/views/Stack/StackView.d.ts.map +1 -0
- package/lib/typescript/module/tsconfig.build.tsbuildinfo +1 -0
- package/package.json +39 -16
- package/src/TransitionConfigs/HeaderStyleInterpolators.tsx +4 -1
- package/src/navigators/createStackNavigator.tsx +4 -6
- package/src/types.tsx +17 -8
- package/src/views/Header/HeaderSegment.tsx +4 -4
- package/src/views/Stack/CardContainer.tsx +5 -1
- package/src/views/Stack/CardSheet.tsx +19 -13
- package/src/views/Stack/CardStack.tsx +0 -3
- package/lib/typescript/src/TransitionConfigs/CardStyleInterpolators.d.ts.map +0 -1
- package/lib/typescript/src/TransitionConfigs/HeaderStyleInterpolators.d.ts.map +0 -1
- package/lib/typescript/src/TransitionConfigs/TransitionPresets.d.ts.map +0 -1
- package/lib/typescript/src/TransitionConfigs/TransitionSpecs.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/navigators/createStackNavigator.d.ts.map +0 -1
- package/lib/typescript/src/types.d.ts.map +0 -1
- package/lib/typescript/src/utils/CardAnimationContext.d.ts.map +0 -1
- package/lib/typescript/src/utils/GestureHandlerRefContext.d.ts.map +0 -1
- package/lib/typescript/src/utils/ModalPresentationContext.d.ts.map +0 -1
- package/lib/typescript/src/utils/conditional.d.ts.map +0 -1
- package/lib/typescript/src/utils/findLastIndex.d.ts.map +0 -1
- package/lib/typescript/src/utils/getDistanceForDirection.d.ts.map +0 -1
- package/lib/typescript/src/utils/getInvertedMultiplier.d.ts.map +0 -1
- package/lib/typescript/src/utils/getModalRoutesKeys.d.ts.map +0 -1
- package/lib/typescript/src/utils/memoize.d.ts.map +0 -1
- package/lib/typescript/src/utils/throttle.d.ts.map +0 -1
- package/lib/typescript/src/utils/useCardAnimation.d.ts.map +0 -1
- package/lib/typescript/src/utils/useGestureHandlerRef.d.ts.map +0 -1
- package/lib/typescript/src/utils/useKeyboardManager.d.ts.map +0 -1
- package/lib/typescript/src/views/GestureHandler.android.d.ts.map +0 -1
- package/lib/typescript/src/views/GestureHandler.d.ts.map +0 -1
- package/lib/typescript/src/views/GestureHandler.ios.d.ts.map +0 -1
- package/lib/typescript/src/views/GestureHandlerNative.d.ts.map +0 -1
- package/lib/typescript/src/views/Header/Header.d.ts.map +0 -1
- package/lib/typescript/src/views/Header/HeaderContainer.d.ts.map +0 -1
- package/lib/typescript/src/views/Header/HeaderSegment.d.ts.map +0 -1
- package/lib/typescript/src/views/Screens.d.ts.map +0 -1
- package/lib/typescript/src/views/Stack/Card.d.ts.map +0 -1
- package/lib/typescript/src/views/Stack/CardContainer.d.ts.map +0 -1
- package/lib/typescript/src/views/Stack/CardSheet.d.ts.map +0 -1
- package/lib/typescript/src/views/Stack/CardStack.d.ts.map +0 -1
- package/lib/typescript/src/views/Stack/StackView.d.ts.map +0 -1
- /package/lib/typescript/{src → commonjs/src}/TransitionConfigs/CardStyleInterpolators.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/TransitionConfigs/HeaderStyleInterpolators.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/TransitionConfigs/TransitionPresets.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/TransitionConfigs/TransitionSpecs.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/index.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/CardAnimationContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/GestureHandlerRefContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/ModalPresentationContext.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/conditional.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/findLastIndex.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/getDistanceForDirection.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/getInvertedMultiplier.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/getModalRoutesKeys.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/memoize.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/throttle.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/useCardAnimation.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/useGestureHandlerRef.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/utils/useKeyboardManager.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/views/GestureHandler.android.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/views/GestureHandler.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/views/GestureHandler.ios.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/views/Header/Header.d.ts +0 -0
- /package/lib/typescript/{src → commonjs/src}/views/Stack/CardSheet.d.ts +0 -0
|
@@ -7,15 +7,29 @@ exports.CardStack = void 0;
|
|
|
7
7
|
var _elements = require("@react-navigation/elements");
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _reactNative = require("react-native");
|
|
10
|
-
var _CardStyleInterpolators = require("../../TransitionConfigs/CardStyleInterpolators");
|
|
11
|
-
var _TransitionPresets = require("../../TransitionConfigs/TransitionPresets");
|
|
12
|
-
var _findLastIndex = require("../../utils/findLastIndex");
|
|
13
|
-
var _getDistanceForDirection = require("../../utils/getDistanceForDirection");
|
|
14
|
-
var _getModalRoutesKeys = require("../../utils/getModalRoutesKeys");
|
|
15
|
-
var _Screens = require("../Screens");
|
|
16
|
-
var _CardContainer = require("./CardContainer");
|
|
10
|
+
var _CardStyleInterpolators = require("../../TransitionConfigs/CardStyleInterpolators.js");
|
|
11
|
+
var _TransitionPresets = require("../../TransitionConfigs/TransitionPresets.js");
|
|
12
|
+
var _findLastIndex = require("../../utils/findLastIndex.js");
|
|
13
|
+
var _getDistanceForDirection = require("../../utils/getDistanceForDirection.js");
|
|
14
|
+
var _getModalRoutesKeys = require("../../utils/getModalRoutesKeys.js");
|
|
15
|
+
var _Screens = require("../Screens.js");
|
|
16
|
+
var _CardContainer = require("./CardContainer.js");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
18
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
18
19
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
20
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
21
|
+
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
|
|
22
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
23
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
24
|
+
function _possibleConstructorReturn(t, e) { if (e && ("object" == typeof e || "function" == typeof e)) return e; if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined"); return _assertThisInitialized(t); }
|
|
25
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
26
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
27
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
28
|
+
function _inherits(t, e) { if ("function" != typeof e && null !== e) throw new TypeError("Super expression must either be null or a function"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, "prototype", { writable: !1 }), e && _setPrototypeOf(t, e); }
|
|
29
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
30
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
31
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
32
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
19
33
|
const NAMED_TRANSITIONS_PRESETS = {
|
|
20
34
|
default: _TransitionPresets.DefaultTransition,
|
|
21
35
|
fade: _TransitionPresets.ModalFadeTransition,
|
|
@@ -110,110 +124,79 @@ const getProgressFromGesture = (gesture, layout, descriptor, isRTL) => {
|
|
|
110
124
|
outputRange: [0, 1]
|
|
111
125
|
});
|
|
112
126
|
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
const descriptor = props.descriptors[curr.key] || props.preloadedDescriptors[curr.key];
|
|
127
|
+
let CardStack = exports.CardStack = /*#__PURE__*/function (_React$Component) {
|
|
128
|
+
function CardStack(_props) {
|
|
129
|
+
var _this;
|
|
130
|
+
_classCallCheck(this, CardStack);
|
|
131
|
+
_this = _callSuper(this, CardStack, [_props]);
|
|
132
|
+
_defineProperty(_this, "handleLayout", e => {
|
|
120
133
|
const {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
134
|
+
height,
|
|
135
|
+
width
|
|
136
|
+
} = e.nativeEvent.layout;
|
|
137
|
+
const layout = {
|
|
138
|
+
width,
|
|
139
|
+
height
|
|
140
|
+
};
|
|
141
|
+
_this.setState((state, props) => {
|
|
142
|
+
if (height === state.layout.height && width === state.layout.width) {
|
|
143
|
+
return null;
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
layout,
|
|
147
|
+
headerHeights: getHeaderHeights(state.scenes, props.insets, props.isParentHeaderShown, props.isParentModal, layout, state.headerHeights)
|
|
148
|
+
};
|
|
149
|
+
});
|
|
129
150
|
});
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
// For example combining a slide and a modal transition would look wrong otherwise
|
|
146
|
-
// With this approach, combining different transition styles in the same navigator mostly looks right
|
|
147
|
-
// This will still be broken when 2 transitions have different idle state (e.g. modal presentation),
|
|
148
|
-
// but the majority of the transitions look alright
|
|
149
|
-
const optionsForTransitionConfig = index !== self.length - 1 && nextDescriptor && nextDescriptor.options.presentation !== 'transparentModal' ? nextDescriptor.options : descriptor.options;
|
|
150
|
-
|
|
151
|
-
// Assume modal if there are already modal screens in the stack
|
|
152
|
-
// or current screen is a modal when no presentation is specified
|
|
153
|
-
const isModal = modalRouteKeys.includes(route.key);
|
|
154
|
-
|
|
155
|
-
// Disable screen transition animation by default on web, windows and macos to match the native behavior
|
|
156
|
-
const excludedPlatforms = _reactNative.Platform.OS !== 'web' && _reactNative.Platform.OS !== 'windows' && _reactNative.Platform.OS !== 'macos';
|
|
157
|
-
const animation = optionsForTransitionConfig.animation ?? (excludedPlatforms ? 'default' : 'none');
|
|
158
|
-
const isAnimationEnabled = animation !== 'none';
|
|
159
|
-
const transitionPreset = animation !== 'default' ? NAMED_TRANSITIONS_PRESETS[animation] : isModal || optionsForTransitionConfig.presentation === 'modal' ? _TransitionPresets.ModalTransition : optionsForTransitionConfig.presentation === 'transparentModal' ? _TransitionPresets.ModalFadeTransition : _TransitionPresets.DefaultTransition;
|
|
160
|
-
const {
|
|
161
|
-
gestureEnabled = _reactNative.Platform.OS === 'ios' && isAnimationEnabled,
|
|
162
|
-
gestureDirection = transitionPreset.gestureDirection,
|
|
163
|
-
transitionSpec = transitionPreset.transitionSpec,
|
|
164
|
-
cardStyleInterpolator = isAnimationEnabled ? transitionPreset.cardStyleInterpolator : _CardStyleInterpolators.forNoAnimation,
|
|
165
|
-
headerStyleInterpolator = transitionPreset.headerStyleInterpolator,
|
|
166
|
-
cardOverlayEnabled = _reactNative.Platform.OS !== 'ios' && optionsForTransitionConfig.presentation !== 'transparentModal' || getIsModalPresentation(cardStyleInterpolator)
|
|
167
|
-
} = optionsForTransitionConfig;
|
|
168
|
-
const headerMode = descriptor.options.headerMode ?? (!(optionsForTransitionConfig.presentation === 'modal' || optionsForTransitionConfig.presentation === 'transparentModal' || nextDescriptor?.options.presentation === 'modal' || nextDescriptor?.options.presentation === 'transparentModal' || getIsModalPresentation(cardStyleInterpolator)) && _reactNative.Platform.OS === 'ios' && descriptor.options.header === undefined ? 'float' : 'screen');
|
|
169
|
-
const isRTL = props.direction === 'rtl';
|
|
170
|
-
const scene = {
|
|
171
|
-
route,
|
|
172
|
-
descriptor: {
|
|
173
|
-
...descriptor,
|
|
174
|
-
options: {
|
|
175
|
-
...descriptor.options,
|
|
176
|
-
animation,
|
|
177
|
-
cardOverlayEnabled,
|
|
178
|
-
cardStyleInterpolator,
|
|
179
|
-
gestureDirection,
|
|
180
|
-
gestureEnabled,
|
|
181
|
-
headerStyleInterpolator,
|
|
182
|
-
transitionSpec,
|
|
183
|
-
headerMode
|
|
151
|
+
_defineProperty(_this, "handleHeaderLayout", ({
|
|
152
|
+
route,
|
|
153
|
+
height
|
|
154
|
+
}) => {
|
|
155
|
+
_this.setState(({
|
|
156
|
+
headerHeights
|
|
157
|
+
}) => {
|
|
158
|
+
const previousHeight = headerHeights[route.key];
|
|
159
|
+
if (previousHeight === height) {
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
return {
|
|
163
|
+
headerHeights: {
|
|
164
|
+
...headerHeights,
|
|
165
|
+
[route.key]: height
|
|
184
166
|
}
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
167
|
+
};
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
_defineProperty(_this, "getFocusedRoute", () => {
|
|
171
|
+
const {
|
|
172
|
+
state
|
|
173
|
+
} = _this.props;
|
|
174
|
+
return state.routes[state.index];
|
|
175
|
+
});
|
|
176
|
+
_defineProperty(_this, "getPreviousScene", ({
|
|
177
|
+
route
|
|
178
|
+
}) => {
|
|
179
|
+
const {
|
|
180
|
+
getPreviousRoute
|
|
181
|
+
} = _this.props;
|
|
182
|
+
const {
|
|
183
|
+
scenes
|
|
184
|
+
} = _this.state;
|
|
185
|
+
const previousRoute = getPreviousRoute({
|
|
186
|
+
route
|
|
187
|
+
});
|
|
188
|
+
if (previousRoute) {
|
|
189
|
+
const previousScene = scenes.find(scene => scene.descriptor.route.key === previousRoute.key);
|
|
190
|
+
return previousScene;
|
|
198
191
|
}
|
|
199
|
-
return
|
|
192
|
+
return undefined;
|
|
200
193
|
});
|
|
201
|
-
|
|
202
|
-
routes: props.routes,
|
|
203
|
-
scenes,
|
|
204
|
-
gestures,
|
|
205
|
-
descriptors: props.descriptors,
|
|
206
|
-
headerHeights: getHeaderHeights(scenes, props.insets, props.isParentHeaderShown, props.isParentModal, state.layout, state.headerHeights)
|
|
207
|
-
};
|
|
208
|
-
}
|
|
209
|
-
constructor(props) {
|
|
210
|
-
super(props);
|
|
211
|
-
this.state = {
|
|
194
|
+
_this.state = {
|
|
212
195
|
routes: [],
|
|
213
196
|
scenes: [],
|
|
214
197
|
gestures: {},
|
|
215
198
|
layout: _elements.SafeAreaProviderCompat.initialMetrics.frame,
|
|
216
|
-
descriptors:
|
|
199
|
+
descriptors: _this.props.descriptors,
|
|
217
200
|
// Used when card's header is null and mode is float to make transition
|
|
218
201
|
// between screens with headers and those without headers smooth.
|
|
219
202
|
// This is not a great heuristic here. We don't know synchronously
|
|
@@ -221,244 +204,286 @@ class CardStack extends React.Component {
|
|
|
221
204
|
// common cases here.
|
|
222
205
|
headerHeights: {}
|
|
223
206
|
};
|
|
207
|
+
return _this;
|
|
224
208
|
}
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
} = e.nativeEvent.layout;
|
|
230
|
-
const layout = {
|
|
231
|
-
width,
|
|
232
|
-
height
|
|
233
|
-
};
|
|
234
|
-
this.setState((state, props) => {
|
|
235
|
-
if (height === state.layout.height && width === state.layout.width) {
|
|
236
|
-
return null;
|
|
237
|
-
}
|
|
238
|
-
return {
|
|
239
|
-
layout,
|
|
240
|
-
headerHeights: getHeaderHeights(state.scenes, props.insets, props.isParentHeaderShown, props.isParentModal, layout, state.headerHeights)
|
|
241
|
-
};
|
|
242
|
-
});
|
|
243
|
-
};
|
|
244
|
-
handleHeaderLayout = ({
|
|
245
|
-
route,
|
|
246
|
-
height
|
|
247
|
-
}) => {
|
|
248
|
-
this.setState(({
|
|
249
|
-
headerHeights
|
|
250
|
-
}) => {
|
|
251
|
-
const previousHeight = headerHeights[route.key];
|
|
252
|
-
if (previousHeight === height) {
|
|
253
|
-
return null;
|
|
254
|
-
}
|
|
255
|
-
return {
|
|
256
|
-
headerHeights: {
|
|
257
|
-
...headerHeights,
|
|
258
|
-
[route.key]: height
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
});
|
|
262
|
-
};
|
|
263
|
-
getFocusedRoute = () => {
|
|
264
|
-
const {
|
|
265
|
-
state
|
|
266
|
-
} = this.props;
|
|
267
|
-
return state.routes[state.index];
|
|
268
|
-
};
|
|
269
|
-
getPreviousScene = ({
|
|
270
|
-
route
|
|
271
|
-
}) => {
|
|
272
|
-
const {
|
|
273
|
-
getPreviousRoute
|
|
274
|
-
} = this.props;
|
|
275
|
-
const {
|
|
276
|
-
scenes
|
|
277
|
-
} = this.state;
|
|
278
|
-
const previousRoute = getPreviousRoute({
|
|
279
|
-
route
|
|
280
|
-
});
|
|
281
|
-
if (previousRoute) {
|
|
282
|
-
const previousScene = scenes.find(scene => scene.descriptor.route.key === previousRoute.key);
|
|
283
|
-
return previousScene;
|
|
284
|
-
}
|
|
285
|
-
return undefined;
|
|
286
|
-
};
|
|
287
|
-
render() {
|
|
288
|
-
const {
|
|
289
|
-
insets,
|
|
290
|
-
state,
|
|
291
|
-
routes,
|
|
292
|
-
closingRouteKeys,
|
|
293
|
-
onOpenRoute,
|
|
294
|
-
onCloseRoute,
|
|
295
|
-
renderHeader,
|
|
296
|
-
isParentHeaderShown,
|
|
297
|
-
isParentModal,
|
|
298
|
-
onTransitionStart,
|
|
299
|
-
onTransitionEnd,
|
|
300
|
-
onGestureStart,
|
|
301
|
-
onGestureEnd,
|
|
302
|
-
onGestureCancel,
|
|
303
|
-
detachInactiveScreens = _reactNative.Platform.OS === 'web' || _reactNative.Platform.OS === 'android' || _reactNative.Platform.OS === 'ios'
|
|
304
|
-
} = this.props;
|
|
305
|
-
const {
|
|
306
|
-
scenes,
|
|
307
|
-
layout,
|
|
308
|
-
gestures,
|
|
309
|
-
headerHeights
|
|
310
|
-
} = this.state;
|
|
311
|
-
const focusedRoute = state.routes[state.index];
|
|
312
|
-
const focusedHeaderHeight = headerHeights[focusedRoute.key];
|
|
313
|
-
const isFloatHeaderAbsolute = this.state.scenes.slice(-2).some(scene => {
|
|
314
|
-
const options = scene.descriptor.options ?? {};
|
|
315
|
-
const {
|
|
316
|
-
headerMode,
|
|
317
|
-
headerTransparent,
|
|
318
|
-
headerShown = true
|
|
319
|
-
} = options;
|
|
320
|
-
if (headerTransparent || headerShown === false || headerMode === 'screen') {
|
|
321
|
-
return true;
|
|
322
|
-
}
|
|
323
|
-
return false;
|
|
324
|
-
});
|
|
325
|
-
let activeScreensLimit = 1;
|
|
326
|
-
for (let i = scenes.length - 1; i >= 0; i--) {
|
|
209
|
+
_inherits(CardStack, _React$Component);
|
|
210
|
+
return _createClass(CardStack, [{
|
|
211
|
+
key: "render",
|
|
212
|
+
value: function render() {
|
|
327
213
|
const {
|
|
328
|
-
|
|
329
|
-
|
|
214
|
+
insets,
|
|
215
|
+
state,
|
|
216
|
+
routes,
|
|
217
|
+
closingRouteKeys,
|
|
218
|
+
onOpenRoute,
|
|
219
|
+
onCloseRoute,
|
|
220
|
+
renderHeader,
|
|
221
|
+
isParentHeaderShown,
|
|
222
|
+
isParentModal,
|
|
223
|
+
onTransitionStart,
|
|
224
|
+
onTransitionEnd,
|
|
225
|
+
onGestureStart,
|
|
226
|
+
onGestureEnd,
|
|
227
|
+
onGestureCancel,
|
|
228
|
+
detachInactiveScreens = _reactNative.Platform.OS === 'web' || _reactNative.Platform.OS === 'android' || _reactNative.Platform.OS === 'ios'
|
|
229
|
+
} = this.props;
|
|
330
230
|
const {
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
if (
|
|
346
|
-
|
|
231
|
+
scenes,
|
|
232
|
+
layout,
|
|
233
|
+
gestures,
|
|
234
|
+
headerHeights
|
|
235
|
+
} = this.state;
|
|
236
|
+
const focusedRoute = state.routes[state.index];
|
|
237
|
+
const focusedHeaderHeight = headerHeights[focusedRoute.key];
|
|
238
|
+
const isFloatHeaderAbsolute = this.state.scenes.slice(-2).some(scene => {
|
|
239
|
+
const options = scene.descriptor.options ?? {};
|
|
240
|
+
const {
|
|
241
|
+
headerMode,
|
|
242
|
+
headerTransparent,
|
|
243
|
+
headerShown = true
|
|
244
|
+
} = options;
|
|
245
|
+
if (headerTransparent || headerShown === false || headerMode === 'screen') {
|
|
246
|
+
return true;
|
|
247
|
+
}
|
|
248
|
+
return false;
|
|
249
|
+
});
|
|
250
|
+
let activeScreensLimit = 1;
|
|
251
|
+
for (let i = scenes.length - 1; i >= 0; i--) {
|
|
252
|
+
const {
|
|
253
|
+
options
|
|
254
|
+
} = scenes[i].descriptor;
|
|
255
|
+
const {
|
|
256
|
+
// By default, we don't want to detach the previous screen of the active one for modals
|
|
257
|
+
detachPreviousScreen = options.presentation === 'transparentModal' ? false : getIsModalPresentation(options.cardStyleInterpolator) ? i !== (0, _findLastIndex.findLastIndex)(scenes, scene => {
|
|
258
|
+
const {
|
|
259
|
+
cardStyleInterpolator
|
|
260
|
+
} = scene.descriptor.options;
|
|
261
|
+
return cardStyleInterpolator === _CardStyleInterpolators.forModalPresentationIOS || cardStyleInterpolator?.name === 'forModalPresentationIOS';
|
|
262
|
+
}) : true
|
|
263
|
+
} = options;
|
|
264
|
+
if (detachPreviousScreen === false) {
|
|
265
|
+
activeScreensLimit++;
|
|
266
|
+
} else {
|
|
267
|
+
// Check at least last 2 screens before stopping
|
|
268
|
+
// This will make sure that screen isn't detached when another screen is animating on top of the transparent one
|
|
269
|
+
// For example, (Opaque -> Transparent -> Opaque)
|
|
270
|
+
if (i <= scenes.length - 2) {
|
|
271
|
+
break;
|
|
272
|
+
}
|
|
347
273
|
}
|
|
348
274
|
}
|
|
275
|
+
const floatingHeader = /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
276
|
+
children: renderHeader({
|
|
277
|
+
mode: 'float',
|
|
278
|
+
layout,
|
|
279
|
+
scenes,
|
|
280
|
+
getPreviousScene: this.getPreviousScene,
|
|
281
|
+
getFocusedRoute: this.getFocusedRoute,
|
|
282
|
+
onContentHeightChange: this.handleHeaderLayout,
|
|
283
|
+
style: [styles.floating, isFloatHeaderAbsolute && [
|
|
284
|
+
// Without this, the header buttons won't be touchable on Android when headerTransparent: true
|
|
285
|
+
{
|
|
286
|
+
height: focusedHeaderHeight
|
|
287
|
+
}, styles.absolute]]
|
|
288
|
+
})
|
|
289
|
+
}, "header");
|
|
290
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_elements.Background, {
|
|
291
|
+
children: [isFloatHeaderAbsolute ? null : floatingHeader, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Screens.MaybeScreenContainer, {
|
|
292
|
+
enabled: detachInactiveScreens,
|
|
293
|
+
style: styles.container,
|
|
294
|
+
onLayout: this.handleLayout,
|
|
295
|
+
children: [...routes, ...state.preloadedRoutes].map((route, index) => {
|
|
296
|
+
const focused = focusedRoute.key === route.key;
|
|
297
|
+
const gesture = gestures[route.key];
|
|
298
|
+
const scene = scenes[index];
|
|
299
|
+
// It is possible that for a short period the route appears in both arrays.
|
|
300
|
+
// Particularly, if the screen is removed with `retain`, then it needs a moment to execute the animation.
|
|
301
|
+
// However, due to the router action, it immediately populates the `preloadedRoutes` array.
|
|
302
|
+
// Practically, the logic below takes care that it is rendered only once.
|
|
303
|
+
const isPreloaded = state.preloadedRoutes.includes(route) && !routes.includes(route);
|
|
304
|
+
if (state.preloadedRoutes.includes(route) && routes.includes(route) && index >= routes.length) {
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
// For the screens that shouldn't be active, the value is 0
|
|
309
|
+
// For those that should be active, but are not the top screen, the value is 1
|
|
310
|
+
// For those on top of the stack and with interaction enabled, the value is 2
|
|
311
|
+
// For the old implementation, it stays the same it was
|
|
312
|
+
let isScreenActive = 1;
|
|
313
|
+
if (index < routes.length - activeScreensLimit - 1 || isPreloaded) {
|
|
314
|
+
// screen should be inactive because it is too deep in the stack
|
|
315
|
+
isScreenActive = STATE_INACTIVE;
|
|
316
|
+
} else {
|
|
317
|
+
const sceneForActivity = scenes[routes.length - 1];
|
|
318
|
+
const outputValue = index === routes.length - 1 ? STATE_ON_TOP // the screen is on top after the transition
|
|
319
|
+
: index >= routes.length - activeScreensLimit ? STATE_TRANSITIONING_OR_BELOW_TOP // the screen should stay active after the transition, it is not on top but is in activeLimit
|
|
320
|
+
: STATE_INACTIVE; // the screen should be active only during the transition, it is at the edge of activeLimit
|
|
321
|
+
isScreenActive = sceneForActivity ? sceneForActivity.progress.current.interpolate({
|
|
322
|
+
inputRange: [0, 1 - EPSILON, 1],
|
|
323
|
+
outputRange: [1, 1, outputValue],
|
|
324
|
+
extrapolate: 'clamp'
|
|
325
|
+
}) : STATE_TRANSITIONING_OR_BELOW_TOP;
|
|
326
|
+
}
|
|
327
|
+
const {
|
|
328
|
+
headerShown = true,
|
|
329
|
+
headerTransparent,
|
|
330
|
+
freezeOnBlur,
|
|
331
|
+
autoHideHomeIndicator
|
|
332
|
+
} = scene.descriptor.options;
|
|
333
|
+
const safeAreaInsetTop = insets.top;
|
|
334
|
+
const safeAreaInsetRight = insets.right;
|
|
335
|
+
const safeAreaInsetBottom = insets.bottom;
|
|
336
|
+
const safeAreaInsetLeft = insets.left;
|
|
337
|
+
const headerHeight = headerShown !== false ? headerHeights[route.key] : 0;
|
|
338
|
+
|
|
339
|
+
// Start from current card and count backwards the number of cards with same interpolation
|
|
340
|
+
const interpolationIndex = getInterpolationIndex(scenes, index);
|
|
341
|
+
const isModal = getIsModal(scene, interpolationIndex, isParentModal);
|
|
342
|
+
const isNextScreenTransparent = scenes[index + 1]?.descriptor.options.presentation === 'transparentModal';
|
|
343
|
+
const detachCurrentScreen = scenes[index + 1]?.descriptor.options.detachPreviousScreen !== false;
|
|
344
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_Screens.MaybeScreen, {
|
|
345
|
+
style: [_reactNative.StyleSheet.absoluteFill],
|
|
346
|
+
enabled: detachInactiveScreens,
|
|
347
|
+
active: isScreenActive,
|
|
348
|
+
freezeOnBlur: freezeOnBlur,
|
|
349
|
+
homeIndicatorHidden: autoHideHomeIndicator,
|
|
350
|
+
pointerEvents: "box-none",
|
|
351
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardContainer.CardContainer, {
|
|
352
|
+
index: index,
|
|
353
|
+
interpolationIndex: interpolationIndex,
|
|
354
|
+
modal: isModal,
|
|
355
|
+
active: index === routes.length - 1,
|
|
356
|
+
focused: focused,
|
|
357
|
+
closing: closingRouteKeys.includes(route.key),
|
|
358
|
+
layout: layout,
|
|
359
|
+
gesture: gesture,
|
|
360
|
+
scene: scene,
|
|
361
|
+
safeAreaInsetTop: safeAreaInsetTop,
|
|
362
|
+
safeAreaInsetRight: safeAreaInsetRight,
|
|
363
|
+
safeAreaInsetBottom: safeAreaInsetBottom,
|
|
364
|
+
safeAreaInsetLeft: safeAreaInsetLeft,
|
|
365
|
+
onGestureStart: onGestureStart,
|
|
366
|
+
onGestureCancel: onGestureCancel,
|
|
367
|
+
onGestureEnd: onGestureEnd,
|
|
368
|
+
headerHeight: headerHeight,
|
|
369
|
+
isParentHeaderShown: isParentHeaderShown,
|
|
370
|
+
onHeaderHeightChange: this.handleHeaderLayout,
|
|
371
|
+
getPreviousScene: this.getPreviousScene,
|
|
372
|
+
getFocusedRoute: this.getFocusedRoute,
|
|
373
|
+
hasAbsoluteFloatHeader: isFloatHeaderAbsolute && !headerTransparent,
|
|
374
|
+
renderHeader: renderHeader,
|
|
375
|
+
onOpenRoute: onOpenRoute,
|
|
376
|
+
onCloseRoute: onCloseRoute,
|
|
377
|
+
onTransitionStart: onTransitionStart,
|
|
378
|
+
onTransitionEnd: onTransitionEnd,
|
|
379
|
+
isNextScreenTransparent: isNextScreenTransparent,
|
|
380
|
+
detachCurrentScreen: detachCurrentScreen,
|
|
381
|
+
preloaded: isPreloaded
|
|
382
|
+
})
|
|
383
|
+
}, route.key);
|
|
384
|
+
})
|
|
385
|
+
}), isFloatHeaderAbsolute ? floatingHeader : null]
|
|
386
|
+
});
|
|
349
387
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
layout,
|
|
355
|
-
scenes,
|
|
356
|
-
getPreviousScene: this.getPreviousScene,
|
|
357
|
-
getFocusedRoute: this.getFocusedRoute,
|
|
358
|
-
onContentHeightChange: this.handleHeaderLayout,
|
|
359
|
-
style: [styles.floating, isFloatHeaderAbsolute && [
|
|
360
|
-
// Without this, the header buttons won't be touchable on Android when headerTransparent: true
|
|
361
|
-
{
|
|
362
|
-
height: focusedHeaderHeight
|
|
363
|
-
}, styles.absolute]]
|
|
364
|
-
}));
|
|
365
|
-
return /*#__PURE__*/React.createElement(_elements.Background, null, isFloatHeaderAbsolute ? null : floatingHeader, /*#__PURE__*/React.createElement(_Screens.MaybeScreenContainer, {
|
|
366
|
-
enabled: detachInactiveScreens,
|
|
367
|
-
style: styles.container,
|
|
368
|
-
onLayout: this.handleLayout
|
|
369
|
-
}, [...routes, ...state.preloadedRoutes].map((route, index) => {
|
|
370
|
-
const focused = focusedRoute.key === route.key;
|
|
371
|
-
const gesture = gestures[route.key];
|
|
372
|
-
const scene = scenes[index];
|
|
373
|
-
// It is possible that for a short period the route appears in both arrays.
|
|
374
|
-
// Particularly, if the screen is removed with `retain`, then it needs a moment to execute the animation.
|
|
375
|
-
// However, due to the router action, it immediately populates the `preloadedRoutes` array.
|
|
376
|
-
// Practically, the logic below takes care that it is rendered only once.
|
|
377
|
-
const isPreloaded = state.preloadedRoutes.includes(route) && !routes.includes(route);
|
|
378
|
-
if (state.preloadedRoutes.includes(route) && routes.includes(route) && index >= routes.length) {
|
|
388
|
+
}], [{
|
|
389
|
+
key: "getDerivedStateFromProps",
|
|
390
|
+
value: function getDerivedStateFromProps(props, state) {
|
|
391
|
+
if (props.routes === state.routes && props.descriptors === state.descriptors) {
|
|
379
392
|
return null;
|
|
380
393
|
}
|
|
394
|
+
const gestures = [...props.routes, ...props.state.preloadedRoutes].reduce((acc, curr) => {
|
|
395
|
+
const descriptor = props.descriptors[curr.key] || props.preloadedDescriptors[curr.key];
|
|
396
|
+
const {
|
|
397
|
+
animation
|
|
398
|
+
} = descriptor?.options || {};
|
|
399
|
+
acc[curr.key] = state.gestures[curr.key] || new _reactNative.Animated.Value(props.openingRouteKeys.includes(curr.key) && animation !== 'none' || props.state.preloadedRoutes.includes(curr) ? getDistanceFromOptions(state.layout, descriptor, props.direction === 'rtl') : 0);
|
|
400
|
+
return acc;
|
|
401
|
+
}, {});
|
|
402
|
+
const modalRouteKeys = (0, _getModalRoutesKeys.getModalRouteKeys)([...props.routes, ...props.state.preloadedRoutes], {
|
|
403
|
+
...props.descriptors,
|
|
404
|
+
...props.preloadedDescriptors
|
|
405
|
+
});
|
|
406
|
+
const scenes = [...props.routes, ...props.state.preloadedRoutes].map((route, index, self) => {
|
|
407
|
+
// For preloaded screens, we don't care about the previous and the next screen
|
|
408
|
+
const isPreloaded = props.state.preloadedRoutes.includes(route);
|
|
409
|
+
const previousRoute = isPreloaded ? undefined : self[index - 1];
|
|
410
|
+
const nextRoute = isPreloaded ? undefined : self[index + 1];
|
|
411
|
+
const oldScene = state.scenes[index];
|
|
412
|
+
const currentGesture = gestures[route.key];
|
|
413
|
+
const previousGesture = previousRoute ? gestures[previousRoute.key] : undefined;
|
|
414
|
+
const nextGesture = nextRoute ? gestures[nextRoute.key] : undefined;
|
|
415
|
+
const descriptor = (isPreloaded ? props.preloadedDescriptors : props.descriptors)[route.key] || state.descriptors[route.key] || (oldScene ? oldScene.descriptor : FALLBACK_DESCRIPTOR);
|
|
416
|
+
const nextDescriptor = nextRoute && (props.descriptors[nextRoute?.key] || state.descriptors[nextRoute?.key]);
|
|
417
|
+
const previousDescriptor = previousRoute && (props.descriptors[previousRoute?.key] || state.descriptors[previousRoute?.key]);
|
|
381
418
|
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
isScreenActive = STATE_INACTIVE;
|
|
390
|
-
} else {
|
|
391
|
-
const sceneForActivity = scenes[routes.length - 1];
|
|
392
|
-
const outputValue = index === routes.length - 1 ? STATE_ON_TOP // the screen is on top after the transition
|
|
393
|
-
: index >= routes.length - activeScreensLimit ? STATE_TRANSITIONING_OR_BELOW_TOP // the screen should stay active after the transition, it is not on top but is in activeLimit
|
|
394
|
-
: STATE_INACTIVE; // the screen should be active only during the transition, it is at the edge of activeLimit
|
|
395
|
-
isScreenActive = sceneForActivity ? sceneForActivity.progress.current.interpolate({
|
|
396
|
-
inputRange: [0, 1 - EPSILON, 1],
|
|
397
|
-
outputRange: [1, 1, outputValue],
|
|
398
|
-
extrapolate: 'clamp'
|
|
399
|
-
}) : STATE_TRANSITIONING_OR_BELOW_TOP;
|
|
400
|
-
}
|
|
401
|
-
const {
|
|
402
|
-
headerShown = true,
|
|
403
|
-
headerTransparent,
|
|
404
|
-
freezeOnBlur,
|
|
405
|
-
autoHideHomeIndicator
|
|
406
|
-
} = scene.descriptor.options;
|
|
407
|
-
const safeAreaInsetTop = insets.top;
|
|
408
|
-
const safeAreaInsetRight = insets.right;
|
|
409
|
-
const safeAreaInsetBottom = insets.bottom;
|
|
410
|
-
const safeAreaInsetLeft = insets.left;
|
|
411
|
-
const headerHeight = headerShown !== false ? headerHeights[route.key] : 0;
|
|
419
|
+
// When a screen is not the last, it should use next screen's transition config
|
|
420
|
+
// Many transitions also animate the previous screen, so using 2 different transitions doesn't look right
|
|
421
|
+
// For example combining a slide and a modal transition would look wrong otherwise
|
|
422
|
+
// With this approach, combining different transition styles in the same navigator mostly looks right
|
|
423
|
+
// This will still be broken when 2 transitions have different idle state (e.g. modal presentation),
|
|
424
|
+
// but the majority of the transitions look alright
|
|
425
|
+
const optionsForTransitionConfig = index !== self.length - 1 && nextDescriptor && nextDescriptor.options.presentation !== 'transparentModal' ? nextDescriptor.options : descriptor.options;
|
|
412
426
|
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
-
|
|
427
|
+
// Assume modal if there are already modal screens in the stack
|
|
428
|
+
// or current screen is a modal when no presentation is specified
|
|
429
|
+
const isModal = modalRouteKeys.includes(route.key);
|
|
430
|
+
|
|
431
|
+
// Disable screen transition animation by default on web, windows and macos to match the native behavior
|
|
432
|
+
const excludedPlatforms = _reactNative.Platform.OS !== 'web' && _reactNative.Platform.OS !== 'windows' && _reactNative.Platform.OS !== 'macos';
|
|
433
|
+
const animation = optionsForTransitionConfig.animation ?? (excludedPlatforms ? 'default' : 'none');
|
|
434
|
+
const isAnimationEnabled = animation !== 'none';
|
|
435
|
+
const transitionPreset = animation !== 'default' ? NAMED_TRANSITIONS_PRESETS[animation] : isModal || optionsForTransitionConfig.presentation === 'modal' ? _TransitionPresets.ModalTransition : optionsForTransitionConfig.presentation === 'transparentModal' ? _TransitionPresets.ModalFadeTransition : _TransitionPresets.DefaultTransition;
|
|
436
|
+
const {
|
|
437
|
+
gestureEnabled = _reactNative.Platform.OS === 'ios' && isAnimationEnabled,
|
|
438
|
+
gestureDirection = transitionPreset.gestureDirection,
|
|
439
|
+
transitionSpec = transitionPreset.transitionSpec,
|
|
440
|
+
cardStyleInterpolator = isAnimationEnabled ? transitionPreset.cardStyleInterpolator : _CardStyleInterpolators.forNoAnimation,
|
|
441
|
+
headerStyleInterpolator = transitionPreset.headerStyleInterpolator,
|
|
442
|
+
cardOverlayEnabled = _reactNative.Platform.OS !== 'ios' && optionsForTransitionConfig.presentation !== 'transparentModal' || getIsModalPresentation(cardStyleInterpolator)
|
|
443
|
+
} = optionsForTransitionConfig;
|
|
444
|
+
const headerMode = descriptor.options.headerMode ?? (!(optionsForTransitionConfig.presentation === 'modal' || optionsForTransitionConfig.presentation === 'transparentModal' || nextDescriptor?.options.presentation === 'modal' || nextDescriptor?.options.presentation === 'transparentModal' || getIsModalPresentation(cardStyleInterpolator)) && _reactNative.Platform.OS === 'ios' && descriptor.options.header === undefined ? 'float' : 'screen');
|
|
445
|
+
const isRTL = props.direction === 'rtl';
|
|
446
|
+
const scene = {
|
|
447
|
+
route,
|
|
448
|
+
descriptor: {
|
|
449
|
+
...descriptor,
|
|
450
|
+
options: {
|
|
451
|
+
...descriptor.options,
|
|
452
|
+
animation,
|
|
453
|
+
cardOverlayEnabled,
|
|
454
|
+
cardStyleInterpolator,
|
|
455
|
+
gestureDirection,
|
|
456
|
+
gestureEnabled,
|
|
457
|
+
headerStyleInterpolator,
|
|
458
|
+
transitionSpec,
|
|
459
|
+
headerMode
|
|
460
|
+
}
|
|
461
|
+
},
|
|
462
|
+
progress: {
|
|
463
|
+
current: getProgressFromGesture(currentGesture, state.layout, descriptor, isRTL),
|
|
464
|
+
next: nextGesture && nextDescriptor?.options.presentation !== 'transparentModal' ? getProgressFromGesture(nextGesture, state.layout, nextDescriptor, isRTL) : undefined,
|
|
465
|
+
previous: previousGesture ? getProgressFromGesture(previousGesture, state.layout, previousDescriptor, isRTL) : undefined
|
|
466
|
+
},
|
|
467
|
+
__memo: [state.layout, descriptor, nextDescriptor, previousDescriptor, currentGesture, nextGesture, previousGesture]
|
|
468
|
+
};
|
|
469
|
+
if (oldScene && scene.__memo.every((it, i) => {
|
|
470
|
+
// @ts-expect-error: we haven't added __memo to the annotation to prevent usage elsewhere
|
|
471
|
+
return oldScene.__memo[i] === it;
|
|
472
|
+
})) {
|
|
473
|
+
return oldScene;
|
|
474
|
+
}
|
|
475
|
+
return scene;
|
|
476
|
+
});
|
|
477
|
+
return {
|
|
478
|
+
routes: props.routes,
|
|
479
|
+
scenes,
|
|
480
|
+
gestures,
|
|
481
|
+
descriptors: props.descriptors,
|
|
482
|
+
headerHeights: getHeaderHeights(scenes, props.insets, props.isParentHeaderShown, props.isParentModal, state.layout, state.headerHeights)
|
|
483
|
+
};
|
|
484
|
+
}
|
|
485
|
+
}]);
|
|
486
|
+
}(React.Component);
|
|
462
487
|
const styles = _reactNative.StyleSheet.create({
|
|
463
488
|
container: {
|
|
464
489
|
flex: 1
|