@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
|
@@ -9,13 +9,26 @@ var _native = require("@react-navigation/native");
|
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _reactNative = require("react-native");
|
|
11
11
|
var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
|
|
12
|
-
var _ModalPresentationContext = require("../../utils/ModalPresentationContext");
|
|
12
|
+
var _ModalPresentationContext = require("../../utils/ModalPresentationContext.js");
|
|
13
13
|
var _GestureHandler = require("../GestureHandler");
|
|
14
|
-
var _HeaderContainer = require("../Header/HeaderContainer");
|
|
15
|
-
var _CardStack = require("./CardStack");
|
|
14
|
+
var _HeaderContainer = require("../Header/HeaderContainer.js");
|
|
15
|
+
var _CardStack = require("./CardStack.js");
|
|
16
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
17
|
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); }
|
|
17
18
|
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; }
|
|
18
|
-
function
|
|
19
|
+
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
|
|
20
|
+
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); } }
|
|
21
|
+
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
|
|
22
|
+
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
23
|
+
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); }
|
|
24
|
+
function _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); return e; }
|
|
25
|
+
function _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function () { return !!t; })(); }
|
|
26
|
+
function _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }
|
|
27
|
+
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); }
|
|
28
|
+
function _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }
|
|
29
|
+
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; }
|
|
30
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
31
|
+
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
32
|
const GestureHandlerWrapper = _GestureHandler.GestureHandlerRootView ?? _reactNative.View;
|
|
20
33
|
|
|
21
34
|
/**
|
|
@@ -23,311 +36,334 @@ const GestureHandlerWrapper = _GestureHandler.GestureHandlerRootView ?? _reactNa
|
|
|
23
36
|
* We need to make sure that both values and order match.
|
|
24
37
|
*/
|
|
25
38
|
const isArrayEqual = (a, b) => a.length === b.length && a.every((it, index) => it === b[index]);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
39
|
+
let StackView = exports.StackView = /*#__PURE__*/function (_React$Component) {
|
|
40
|
+
function StackView(...args) {
|
|
41
|
+
var _this;
|
|
42
|
+
_classCallCheck(this, StackView);
|
|
43
|
+
_this = _callSuper(this, StackView, [...args]);
|
|
44
|
+
_defineProperty(_this, "state", {
|
|
45
|
+
routes: [],
|
|
46
|
+
previousRoutes: [],
|
|
47
|
+
previousDescriptors: {},
|
|
48
|
+
openingRouteKeys: [],
|
|
49
|
+
closingRouteKeys: [],
|
|
50
|
+
replacingRouteKeys: [],
|
|
51
|
+
descriptors: {}
|
|
52
|
+
});
|
|
53
|
+
_defineProperty(_this, "getPreviousRoute", ({
|
|
54
|
+
route
|
|
55
|
+
}) => {
|
|
56
|
+
const {
|
|
57
|
+
closingRouteKeys,
|
|
58
|
+
replacingRouteKeys
|
|
59
|
+
} = _this.state;
|
|
60
|
+
const routes = _this.state.routes.filter(r => r.key === route.key || !closingRouteKeys.includes(r.key) && !replacingRouteKeys.includes(r.key));
|
|
61
|
+
const index = routes.findIndex(r => r.key === route.key);
|
|
62
|
+
return routes[index - 1];
|
|
63
|
+
});
|
|
64
|
+
_defineProperty(_this, "renderHeader", props => {
|
|
65
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeaderContainer.HeaderContainer, {
|
|
66
|
+
...props
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
_defineProperty(_this, "handleOpenRoute", ({
|
|
70
|
+
route
|
|
71
|
+
}) => {
|
|
72
|
+
const {
|
|
73
|
+
state,
|
|
74
|
+
navigation
|
|
75
|
+
} = _this.props;
|
|
76
|
+
const {
|
|
77
|
+
closingRouteKeys,
|
|
78
|
+
replacingRouteKeys
|
|
79
|
+
} = _this.state;
|
|
80
|
+
if (closingRouteKeys.some(key => key === route.key) && replacingRouteKeys.every(key => key !== route.key) && state.routeNames.includes(route.name) && !state.routes.some(r => r.key === route.key)) {
|
|
81
|
+
// If route isn't present in current state, but was closing, assume that a close animation was cancelled
|
|
82
|
+
// So we need to add this route back to the state
|
|
83
|
+
navigation.dispatch(state => {
|
|
84
|
+
const routes = [...state.routes.filter(r => r.key !== route.key), route];
|
|
85
|
+
return _native.CommonActions.reset({
|
|
86
|
+
...state,
|
|
87
|
+
routes,
|
|
88
|
+
index: routes.length - 1
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
} else {
|
|
92
|
+
_this.setState(state => ({
|
|
93
|
+
routes: state.replacingRouteKeys.length ? state.routes.filter(r => !state.replacingRouteKeys.includes(r.key)) : state.routes,
|
|
94
|
+
openingRouteKeys: state.openingRouteKeys.filter(key => key !== route.key),
|
|
95
|
+
closingRouteKeys: state.closingRouteKeys.filter(key => key !== route.key),
|
|
96
|
+
replacingRouteKeys: []
|
|
97
|
+
}));
|
|
40
98
|
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
99
|
+
});
|
|
100
|
+
_defineProperty(_this, "handleCloseRoute", ({
|
|
101
|
+
route
|
|
102
|
+
}) => {
|
|
103
|
+
const {
|
|
104
|
+
state,
|
|
105
|
+
navigation
|
|
106
|
+
} = _this.props;
|
|
107
|
+
if (state.routes.some(r => r.key === route.key)) {
|
|
108
|
+
// If a route exists in state, trigger a pop
|
|
109
|
+
// This will happen in when the route was closed from the card component
|
|
110
|
+
// e.g. When the close animation triggered from a gesture ends
|
|
111
|
+
navigation.dispatch({
|
|
112
|
+
..._native.StackActions.pop(),
|
|
113
|
+
source: route.key,
|
|
114
|
+
target: state.key
|
|
115
|
+
});
|
|
116
|
+
} else {
|
|
117
|
+
// We need to clean up any state tracking the route and pop it immediately
|
|
118
|
+
_this.setState(state => ({
|
|
119
|
+
routes: state.routes.filter(r => r.key !== route.key),
|
|
120
|
+
openingRouteKeys: state.openingRouteKeys.filter(key => key !== route.key),
|
|
121
|
+
closingRouteKeys: state.closingRouteKeys.filter(key => key !== route.key)
|
|
122
|
+
}));
|
|
49
123
|
}
|
|
50
|
-
|
|
124
|
+
});
|
|
125
|
+
_defineProperty(_this, "handleTransitionStart", ({
|
|
126
|
+
route
|
|
127
|
+
}, closing) => _this.props.navigation.emit({
|
|
128
|
+
type: 'transitionStart',
|
|
129
|
+
data: {
|
|
130
|
+
closing
|
|
131
|
+
},
|
|
132
|
+
target: route.key
|
|
133
|
+
}));
|
|
134
|
+
_defineProperty(_this, "handleTransitionEnd", ({
|
|
135
|
+
route
|
|
136
|
+
}, closing) => _this.props.navigation.emit({
|
|
137
|
+
type: 'transitionEnd',
|
|
138
|
+
data: {
|
|
139
|
+
closing
|
|
140
|
+
},
|
|
141
|
+
target: route.key
|
|
142
|
+
}));
|
|
143
|
+
_defineProperty(_this, "handleGestureStart", ({
|
|
144
|
+
route
|
|
145
|
+
}) => {
|
|
146
|
+
_this.props.navigation.emit({
|
|
147
|
+
type: 'gestureStart',
|
|
148
|
+
target: route.key
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
_defineProperty(_this, "handleGestureEnd", ({
|
|
152
|
+
route
|
|
153
|
+
}) => {
|
|
154
|
+
_this.props.navigation.emit({
|
|
155
|
+
type: 'gestureEnd',
|
|
156
|
+
target: route.key
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
_defineProperty(_this, "handleGestureCancel", ({
|
|
160
|
+
route
|
|
161
|
+
}) => {
|
|
162
|
+
_this.props.navigation.emit({
|
|
163
|
+
type: 'gestureCancel',
|
|
164
|
+
target: route.key
|
|
165
|
+
});
|
|
166
|
+
});
|
|
167
|
+
return _this;
|
|
168
|
+
}
|
|
169
|
+
_inherits(StackView, _React$Component);
|
|
170
|
+
return _createClass(StackView, [{
|
|
171
|
+
key: "render",
|
|
172
|
+
value: function render() {
|
|
173
|
+
const {
|
|
174
|
+
state,
|
|
175
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
176
|
+
descriptors: _,
|
|
177
|
+
...rest
|
|
178
|
+
} = this.props;
|
|
179
|
+
const {
|
|
51
180
|
routes,
|
|
52
|
-
previousRoutes,
|
|
53
181
|
descriptors,
|
|
54
|
-
|
|
55
|
-
|
|
182
|
+
openingRouteKeys,
|
|
183
|
+
closingRouteKeys
|
|
184
|
+
} = this.state;
|
|
185
|
+
const preloadedDescriptors = state.preloadedRoutes.reduce((acc, route) => {
|
|
186
|
+
acc[route.key] = acc[route.key] || this.props.describe(route, true);
|
|
187
|
+
return acc;
|
|
188
|
+
}, {});
|
|
189
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(GestureHandlerWrapper, {
|
|
190
|
+
style: styles.container,
|
|
191
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.SafeAreaProviderCompat, {
|
|
192
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_reactNativeSafeAreaContext.SafeAreaInsetsContext.Consumer, {
|
|
193
|
+
children: insets => /*#__PURE__*/(0, _jsxRuntime.jsx)(_ModalPresentationContext.ModalPresentationContext.Consumer, {
|
|
194
|
+
children: isParentModal => /*#__PURE__*/(0, _jsxRuntime.jsx)(_elements.HeaderShownContext.Consumer, {
|
|
195
|
+
children: isParentHeaderShown => /*#__PURE__*/(0, _jsxRuntime.jsx)(_CardStack.CardStack, {
|
|
196
|
+
insets: insets,
|
|
197
|
+
isParentHeaderShown: isParentHeaderShown,
|
|
198
|
+
isParentModal: isParentModal,
|
|
199
|
+
getPreviousRoute: this.getPreviousRoute,
|
|
200
|
+
routes: routes,
|
|
201
|
+
openingRouteKeys: openingRouteKeys,
|
|
202
|
+
closingRouteKeys: closingRouteKeys,
|
|
203
|
+
onOpenRoute: this.handleOpenRoute,
|
|
204
|
+
onCloseRoute: this.handleCloseRoute,
|
|
205
|
+
onTransitionStart: this.handleTransitionStart,
|
|
206
|
+
onTransitionEnd: this.handleTransitionEnd,
|
|
207
|
+
renderHeader: this.renderHeader,
|
|
208
|
+
state: state,
|
|
209
|
+
descriptors: descriptors,
|
|
210
|
+
onGestureStart: this.handleGestureStart,
|
|
211
|
+
onGestureEnd: this.handleGestureEnd,
|
|
212
|
+
onGestureCancel: this.handleGestureCancel,
|
|
213
|
+
preloadedDescriptors: preloadedDescriptors,
|
|
214
|
+
...rest
|
|
215
|
+
})
|
|
216
|
+
})
|
|
217
|
+
})
|
|
218
|
+
})
|
|
219
|
+
})
|
|
220
|
+
});
|
|
56
221
|
}
|
|
222
|
+
}], [{
|
|
223
|
+
key: "getDerivedStateFromProps",
|
|
224
|
+
value: function getDerivedStateFromProps(props, state) {
|
|
225
|
+
// If there was no change in routes, we don't need to compute anything
|
|
226
|
+
if ((props.state.routes === state.previousRoutes || isArrayEqual(props.state.routes.map(r => r.key), state.previousRoutes.map(r => r.key))) && state.routes.length) {
|
|
227
|
+
let routes = state.routes;
|
|
228
|
+
let previousRoutes = state.previousRoutes;
|
|
229
|
+
let descriptors = props.descriptors;
|
|
230
|
+
let previousDescriptors = state.previousDescriptors;
|
|
231
|
+
if (props.descriptors !== state.previousDescriptors) {
|
|
232
|
+
descriptors = state.routes.reduce((acc, route) => {
|
|
233
|
+
acc[route.key] = props.descriptors[route.key] || state.descriptors[route.key];
|
|
234
|
+
return acc;
|
|
235
|
+
}, {});
|
|
236
|
+
previousDescriptors = props.descriptors;
|
|
237
|
+
}
|
|
238
|
+
if (props.state.routes !== state.previousRoutes) {
|
|
239
|
+
// if any route objects have changed, we should update them
|
|
240
|
+
const map = props.state.routes.reduce((acc, route) => {
|
|
241
|
+
acc[route.key] = route;
|
|
242
|
+
return acc;
|
|
243
|
+
}, {});
|
|
244
|
+
routes = state.routes.map(route => map[route.key] || route);
|
|
245
|
+
previousRoutes = props.state.routes;
|
|
246
|
+
}
|
|
247
|
+
return {
|
|
248
|
+
routes,
|
|
249
|
+
previousRoutes,
|
|
250
|
+
descriptors,
|
|
251
|
+
previousDescriptors
|
|
252
|
+
};
|
|
253
|
+
}
|
|
57
254
|
|
|
58
|
-
|
|
59
|
-
|
|
255
|
+
// Here we determine which routes were added or removed to animate them
|
|
256
|
+
// We keep a copy of the route being removed in local state to be able to animate it
|
|
60
257
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
258
|
+
let routes = props.state.index < props.state.routes.length - 1 ?
|
|
259
|
+
// Remove any extra routes from the state
|
|
260
|
+
// The last visible route should be the focused route, i.e. at current index
|
|
261
|
+
props.state.routes.slice(0, props.state.index + 1) : props.state.routes;
|
|
65
262
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
263
|
+
// Now we need to determine which routes were added and removed
|
|
264
|
+
const {
|
|
265
|
+
previousRoutes
|
|
266
|
+
} = state;
|
|
267
|
+
let {
|
|
268
|
+
openingRouteKeys,
|
|
269
|
+
closingRouteKeys,
|
|
270
|
+
replacingRouteKeys
|
|
271
|
+
} = state;
|
|
272
|
+
const previousFocusedRoute = previousRoutes[previousRoutes.length - 1];
|
|
273
|
+
const nextFocusedRoute = routes[routes.length - 1];
|
|
274
|
+
const isAnimationEnabled = key => {
|
|
275
|
+
const descriptor = props.descriptors[key] || state.descriptors[key];
|
|
276
|
+
return descriptor ? descriptor.options.animation !== 'none' : true;
|
|
277
|
+
};
|
|
278
|
+
const getAnimationTypeForReplace = key => {
|
|
279
|
+
const descriptor = props.descriptors[key] || state.descriptors[key];
|
|
280
|
+
return descriptor.options.animationTypeForReplace ?? 'push';
|
|
281
|
+
};
|
|
282
|
+
if (previousFocusedRoute && previousFocusedRoute.key !== nextFocusedRoute.key) {
|
|
283
|
+
// We only need to animate routes if the focused route changed
|
|
284
|
+
// Animating previous routes won't be visible coz the focused route is on top of everything
|
|
88
285
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
286
|
+
if (!previousRoutes.some(r => r.key === nextFocusedRoute.key)) {
|
|
287
|
+
// A new route has come to the focus, we treat this as a push
|
|
288
|
+
// A replace can also trigger this, the animation should look like push
|
|
92
289
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
290
|
+
if (isAnimationEnabled(nextFocusedRoute.key) && !openingRouteKeys.includes(nextFocusedRoute.key)) {
|
|
291
|
+
// In this case, we need to animate pushing the focused route
|
|
292
|
+
// We don't care about animating any other added routes because they won't be visible
|
|
293
|
+
openingRouteKeys = [...openingRouteKeys, nextFocusedRoute.key];
|
|
294
|
+
closingRouteKeys = closingRouteKeys.filter(key => key !== nextFocusedRoute.key);
|
|
295
|
+
replacingRouteKeys = replacingRouteKeys.filter(key => key !== nextFocusedRoute.key);
|
|
296
|
+
if (!routes.some(r => r.key === previousFocusedRoute.key)) {
|
|
297
|
+
// The previous focused route isn't present in state, we treat this as a replace
|
|
101
298
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
299
|
+
openingRouteKeys = openingRouteKeys.filter(key => key !== previousFocusedRoute.key);
|
|
300
|
+
if (getAnimationTypeForReplace(nextFocusedRoute.key) === 'pop') {
|
|
301
|
+
closingRouteKeys = [...closingRouteKeys, previousFocusedRoute.key];
|
|
105
302
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
303
|
+
// By default, new routes have a push animation, so we add it to `openingRouteKeys` before
|
|
304
|
+
// But since user configured it to animate the old screen like a pop, we need to add this without animation
|
|
305
|
+
// So remove it from `openingRouteKeys` which will remove the animation
|
|
306
|
+
openingRouteKeys = openingRouteKeys.filter(key => key !== nextFocusedRoute.key);
|
|
110
307
|
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
308
|
+
// Keep the route being removed at the end to animate it out
|
|
309
|
+
routes = [...routes, previousFocusedRoute];
|
|
310
|
+
} else {
|
|
311
|
+
replacingRouteKeys = [...replacingRouteKeys, previousFocusedRoute.key];
|
|
312
|
+
closingRouteKeys = closingRouteKeys.filter(key => key !== previousFocusedRoute.key);
|
|
116
313
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
314
|
+
// Keep the old route in the state because it's visible under the new route, and removing it will feel abrupt
|
|
315
|
+
// We need to insert it just before the focused one (the route being pushed)
|
|
316
|
+
// After the push animation is completed, routes being replaced will be removed completely
|
|
317
|
+
routes = routes.slice();
|
|
318
|
+
routes.splice(routes.length - 1, 0, previousFocusedRoute);
|
|
319
|
+
}
|
|
122
320
|
}
|
|
123
321
|
}
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// The previously focused route was removed, we treat this as a pop
|
|
322
|
+
} else if (!routes.some(r => r.key === previousFocusedRoute.key)) {
|
|
323
|
+
// The previously focused route was removed, we treat this as a pop
|
|
127
324
|
|
|
128
|
-
|
|
129
|
-
|
|
325
|
+
if (isAnimationEnabled(previousFocusedRoute.key) && !closingRouteKeys.includes(previousFocusedRoute.key)) {
|
|
326
|
+
closingRouteKeys = [...closingRouteKeys, previousFocusedRoute.key];
|
|
130
327
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
328
|
+
// Sometimes a route can be closed before the opening animation finishes
|
|
329
|
+
// So we also need to remove it from the opening list
|
|
330
|
+
openingRouteKeys = openingRouteKeys.filter(key => key !== previousFocusedRoute.key);
|
|
331
|
+
replacingRouteKeys = replacingRouteKeys.filter(key => key !== previousFocusedRoute.key);
|
|
135
332
|
|
|
136
|
-
|
|
137
|
-
|
|
333
|
+
// Keep a copy of route being removed in the state to be able to animate it
|
|
334
|
+
routes = [...routes, previousFocusedRoute];
|
|
335
|
+
}
|
|
336
|
+
} else {
|
|
337
|
+
// Looks like some routes were re-arranged and no focused routes were added/removed
|
|
338
|
+
// i.e. the currently focused route already existed and the previously focused route still exists
|
|
339
|
+
// We don't know how to animate this
|
|
138
340
|
}
|
|
139
|
-
} else {
|
|
140
|
-
//
|
|
141
|
-
|
|
142
|
-
|
|
341
|
+
} else if (replacingRouteKeys.length || closingRouteKeys.length) {
|
|
342
|
+
// Keep the routes we are closing or replacing if animation is enabled for them
|
|
343
|
+
routes = routes.slice();
|
|
344
|
+
routes.splice(routes.length - 1, 0, ...state.routes.filter(({
|
|
345
|
+
key
|
|
346
|
+
}) => isAnimationEnabled(key) ? replacingRouteKeys.includes(key) || closingRouteKeys.includes(key) : false));
|
|
143
347
|
}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
key
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
previousRoutes: props.state.routes,
|
|
161
|
-
previousDescriptors: props.descriptors,
|
|
162
|
-
openingRouteKeys,
|
|
163
|
-
closingRouteKeys,
|
|
164
|
-
replacingRouteKeys,
|
|
165
|
-
descriptors
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
state = {
|
|
169
|
-
routes: [],
|
|
170
|
-
previousRoutes: [],
|
|
171
|
-
previousDescriptors: {},
|
|
172
|
-
openingRouteKeys: [],
|
|
173
|
-
closingRouteKeys: [],
|
|
174
|
-
replacingRouteKeys: [],
|
|
175
|
-
descriptors: {}
|
|
176
|
-
};
|
|
177
|
-
getPreviousRoute = ({
|
|
178
|
-
route
|
|
179
|
-
}) => {
|
|
180
|
-
const {
|
|
181
|
-
closingRouteKeys,
|
|
182
|
-
replacingRouteKeys
|
|
183
|
-
} = this.state;
|
|
184
|
-
const routes = this.state.routes.filter(r => r.key === route.key || !closingRouteKeys.includes(r.key) && !replacingRouteKeys.includes(r.key));
|
|
185
|
-
const index = routes.findIndex(r => r.key === route.key);
|
|
186
|
-
return routes[index - 1];
|
|
187
|
-
};
|
|
188
|
-
renderHeader = props => {
|
|
189
|
-
return /*#__PURE__*/React.createElement(_HeaderContainer.HeaderContainer, props);
|
|
190
|
-
};
|
|
191
|
-
handleOpenRoute = ({
|
|
192
|
-
route
|
|
193
|
-
}) => {
|
|
194
|
-
const {
|
|
195
|
-
state,
|
|
196
|
-
navigation
|
|
197
|
-
} = this.props;
|
|
198
|
-
const {
|
|
199
|
-
closingRouteKeys,
|
|
200
|
-
replacingRouteKeys
|
|
201
|
-
} = this.state;
|
|
202
|
-
if (closingRouteKeys.some(key => key === route.key) && replacingRouteKeys.every(key => key !== route.key) && state.routeNames.includes(route.name) && !state.routes.some(r => r.key === route.key)) {
|
|
203
|
-
// If route isn't present in current state, but was closing, assume that a close animation was cancelled
|
|
204
|
-
// So we need to add this route back to the state
|
|
205
|
-
navigation.dispatch(state => {
|
|
206
|
-
const routes = [...state.routes.filter(r => r.key !== route.key), route];
|
|
207
|
-
return _native.CommonActions.reset({
|
|
208
|
-
...state,
|
|
209
|
-
routes,
|
|
210
|
-
index: routes.length - 1
|
|
211
|
-
});
|
|
212
|
-
});
|
|
213
|
-
} else {
|
|
214
|
-
this.setState(state => ({
|
|
215
|
-
routes: state.replacingRouteKeys.length ? state.routes.filter(r => !state.replacingRouteKeys.includes(r.key)) : state.routes,
|
|
216
|
-
openingRouteKeys: state.openingRouteKeys.filter(key => key !== route.key),
|
|
217
|
-
closingRouteKeys: state.closingRouteKeys.filter(key => key !== route.key),
|
|
218
|
-
replacingRouteKeys: []
|
|
219
|
-
}));
|
|
220
|
-
}
|
|
221
|
-
};
|
|
222
|
-
handleCloseRoute = ({
|
|
223
|
-
route
|
|
224
|
-
}) => {
|
|
225
|
-
const {
|
|
226
|
-
state,
|
|
227
|
-
navigation
|
|
228
|
-
} = this.props;
|
|
229
|
-
if (state.routes.some(r => r.key === route.key)) {
|
|
230
|
-
// If a route exists in state, trigger a pop
|
|
231
|
-
// This will happen in when the route was closed from the card component
|
|
232
|
-
// e.g. When the close animation triggered from a gesture ends
|
|
233
|
-
navigation.dispatch({
|
|
234
|
-
..._native.StackActions.pop(),
|
|
235
|
-
source: route.key,
|
|
236
|
-
target: state.key
|
|
237
|
-
});
|
|
238
|
-
} else {
|
|
239
|
-
// We need to clean up any state tracking the route and pop it immediately
|
|
240
|
-
this.setState(state => ({
|
|
241
|
-
routes: state.routes.filter(r => r.key !== route.key),
|
|
242
|
-
openingRouteKeys: state.openingRouteKeys.filter(key => key !== route.key),
|
|
243
|
-
closingRouteKeys: state.closingRouteKeys.filter(key => key !== route.key)
|
|
244
|
-
}));
|
|
348
|
+
if (!routes.length) {
|
|
349
|
+
throw new Error('There should always be at least one route in the navigation state.');
|
|
350
|
+
}
|
|
351
|
+
const descriptors = routes.reduce((acc, route) => {
|
|
352
|
+
acc[route.key] = props.descriptors[route.key] || state.descriptors[route.key];
|
|
353
|
+
return acc;
|
|
354
|
+
}, {});
|
|
355
|
+
return {
|
|
356
|
+
routes,
|
|
357
|
+
previousRoutes: props.state.routes,
|
|
358
|
+
previousDescriptors: props.descriptors,
|
|
359
|
+
openingRouteKeys,
|
|
360
|
+
closingRouteKeys,
|
|
361
|
+
replacingRouteKeys,
|
|
362
|
+
descriptors
|
|
363
|
+
};
|
|
245
364
|
}
|
|
246
|
-
};
|
|
247
|
-
|
|
248
|
-
route
|
|
249
|
-
}, closing) => this.props.navigation.emit({
|
|
250
|
-
type: 'transitionStart',
|
|
251
|
-
data: {
|
|
252
|
-
closing
|
|
253
|
-
},
|
|
254
|
-
target: route.key
|
|
255
|
-
});
|
|
256
|
-
handleTransitionEnd = ({
|
|
257
|
-
route
|
|
258
|
-
}, closing) => this.props.navigation.emit({
|
|
259
|
-
type: 'transitionEnd',
|
|
260
|
-
data: {
|
|
261
|
-
closing
|
|
262
|
-
},
|
|
263
|
-
target: route.key
|
|
264
|
-
});
|
|
265
|
-
handleGestureStart = ({
|
|
266
|
-
route
|
|
267
|
-
}) => {
|
|
268
|
-
this.props.navigation.emit({
|
|
269
|
-
type: 'gestureStart',
|
|
270
|
-
target: route.key
|
|
271
|
-
});
|
|
272
|
-
};
|
|
273
|
-
handleGestureEnd = ({
|
|
274
|
-
route
|
|
275
|
-
}) => {
|
|
276
|
-
this.props.navigation.emit({
|
|
277
|
-
type: 'gestureEnd',
|
|
278
|
-
target: route.key
|
|
279
|
-
});
|
|
280
|
-
};
|
|
281
|
-
handleGestureCancel = ({
|
|
282
|
-
route
|
|
283
|
-
}) => {
|
|
284
|
-
this.props.navigation.emit({
|
|
285
|
-
type: 'gestureCancel',
|
|
286
|
-
target: route.key
|
|
287
|
-
});
|
|
288
|
-
};
|
|
289
|
-
render() {
|
|
290
|
-
const {
|
|
291
|
-
state,
|
|
292
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
293
|
-
descriptors: _,
|
|
294
|
-
...rest
|
|
295
|
-
} = this.props;
|
|
296
|
-
const {
|
|
297
|
-
routes,
|
|
298
|
-
descriptors,
|
|
299
|
-
openingRouteKeys,
|
|
300
|
-
closingRouteKeys
|
|
301
|
-
} = this.state;
|
|
302
|
-
const preloadedDescriptors = state.preloadedRoutes.reduce((acc, route) => {
|
|
303
|
-
acc[route.key] = acc[route.key] || this.props.describe(route, true);
|
|
304
|
-
return acc;
|
|
305
|
-
}, {});
|
|
306
|
-
return /*#__PURE__*/React.createElement(GestureHandlerWrapper, {
|
|
307
|
-
style: styles.container
|
|
308
|
-
}, /*#__PURE__*/React.createElement(_elements.SafeAreaProviderCompat, null, /*#__PURE__*/React.createElement(_reactNativeSafeAreaContext.SafeAreaInsetsContext.Consumer, null, insets => /*#__PURE__*/React.createElement(_ModalPresentationContext.ModalPresentationContext.Consumer, null, isParentModal => /*#__PURE__*/React.createElement(_elements.HeaderShownContext.Consumer, null, isParentHeaderShown => /*#__PURE__*/React.createElement(_CardStack.CardStack, _extends({
|
|
309
|
-
insets: insets,
|
|
310
|
-
isParentHeaderShown: isParentHeaderShown,
|
|
311
|
-
isParentModal: isParentModal,
|
|
312
|
-
getPreviousRoute: this.getPreviousRoute,
|
|
313
|
-
routes: routes,
|
|
314
|
-
openingRouteKeys: openingRouteKeys,
|
|
315
|
-
closingRouteKeys: closingRouteKeys,
|
|
316
|
-
onOpenRoute: this.handleOpenRoute,
|
|
317
|
-
onCloseRoute: this.handleCloseRoute,
|
|
318
|
-
onTransitionStart: this.handleTransitionStart,
|
|
319
|
-
onTransitionEnd: this.handleTransitionEnd,
|
|
320
|
-
renderHeader: this.renderHeader,
|
|
321
|
-
state: state,
|
|
322
|
-
descriptors: descriptors,
|
|
323
|
-
onGestureStart: this.handleGestureStart,
|
|
324
|
-
onGestureEnd: this.handleGestureEnd,
|
|
325
|
-
onGestureCancel: this.handleGestureCancel,
|
|
326
|
-
preloadedDescriptors: preloadedDescriptors
|
|
327
|
-
}, rest)))))));
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
exports.StackView = StackView;
|
|
365
|
+
}]);
|
|
366
|
+
}(React.Component);
|
|
331
367
|
const styles = _reactNative.StyleSheet.create({
|
|
332
368
|
container: {
|
|
333
369
|
flex: 1
|