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