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