@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 Color from 'color';
|
|
3
17
|
import * as React from 'react';
|
|
4
18
|
import { Animated, InteractionManager, Platform, StyleSheet, View } from 'react-native';
|
|
5
|
-
import { CardAnimationContext } from
|
|
6
|
-
import { getDistanceForDirection } from
|
|
7
|
-
import { getInvertedMultiplier } from
|
|
8
|
-
import { memoize } from
|
|
19
|
+
import { CardAnimationContext } from "../../utils/CardAnimationContext.js";
|
|
20
|
+
import { getDistanceForDirection } from "../../utils/getDistanceForDirection.js";
|
|
21
|
+
import { getInvertedMultiplier } from "../../utils/getInvertedMultiplier.js";
|
|
22
|
+
import { memoize } from "../../utils/memoize.js";
|
|
9
23
|
import { GestureState, PanGestureHandler } from '../GestureHandler';
|
|
10
|
-
import { CardSheet } from
|
|
24
|
+
import { CardSheet } from "./CardSheet.js";
|
|
25
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
26
|
const GESTURE_VELOCITY_IMPACT = 0.3;
|
|
12
27
|
const TRUE = 1;
|
|
13
28
|
const FALSE = 0;
|
|
@@ -25,395 +40,423 @@ const hasOpacityStyle = style => {
|
|
|
25
40
|
}
|
|
26
41
|
return false;
|
|
27
42
|
};
|
|
28
|
-
export
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
40
|
-
componentDidMount() {
|
|
41
|
-
if (!this.props.preloaded) {
|
|
42
|
-
this.animate({
|
|
43
|
-
closing: this.props.closing
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
this.isCurrentlyMounted = true;
|
|
47
|
-
}
|
|
48
|
-
componentDidUpdate(prevProps) {
|
|
49
|
-
const {
|
|
50
|
-
direction,
|
|
51
|
-
layout,
|
|
52
|
-
gestureDirection,
|
|
53
|
-
closing
|
|
54
|
-
} = this.props;
|
|
55
|
-
const {
|
|
56
|
-
width,
|
|
57
|
-
height
|
|
58
|
-
} = layout;
|
|
59
|
-
if (width !== prevProps.layout.width) {
|
|
60
|
-
this.layout.width.setValue(width);
|
|
61
|
-
}
|
|
62
|
-
if (height !== prevProps.layout.height) {
|
|
63
|
-
this.layout.height.setValue(height);
|
|
64
|
-
}
|
|
65
|
-
if (gestureDirection !== prevProps.gestureDirection) {
|
|
66
|
-
this.inverted.setValue(getInvertedMultiplier(gestureDirection, direction === 'rtl'));
|
|
67
|
-
}
|
|
68
|
-
const toValue = this.getAnimateToValue(this.props);
|
|
69
|
-
if (this.getAnimateToValue(prevProps) !== toValue || this.lastToValue !== toValue) {
|
|
70
|
-
// We need to trigger the animation when route was closed
|
|
71
|
-
// The route might have been closed by a `POP` action or by a gesture
|
|
72
|
-
// When route was closed due to a gesture, the animation would've happened already
|
|
73
|
-
// It's still important to trigger the animation so that `onClose` is called
|
|
74
|
-
// If `onClose` is not called, cleanup step won't be performed for gestures
|
|
75
|
-
this.animate({
|
|
76
|
-
closing
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
componentWillUnmount() {
|
|
81
|
-
this.props.gesture?.stopAnimation();
|
|
82
|
-
this.isCurrentlyMounted = false;
|
|
83
|
-
this.handleEndInteraction();
|
|
84
|
-
}
|
|
85
|
-
isCurrentlyMounted = false;
|
|
86
|
-
isClosing = new Animated.Value(FALSE);
|
|
87
|
-
inverted = new Animated.Value(getInvertedMultiplier(this.props.gestureDirection, this.props.direction === 'rtl'));
|
|
88
|
-
layout = {
|
|
89
|
-
width: new Animated.Value(this.props.layout.width),
|
|
90
|
-
height: new Animated.Value(this.props.layout.height)
|
|
91
|
-
};
|
|
92
|
-
isSwiping = new Animated.Value(FALSE);
|
|
93
|
-
animate = ({
|
|
94
|
-
closing,
|
|
95
|
-
velocity
|
|
96
|
-
}) => {
|
|
97
|
-
const {
|
|
98
|
-
transitionSpec,
|
|
99
|
-
onOpen,
|
|
100
|
-
onClose,
|
|
101
|
-
onTransition,
|
|
102
|
-
gesture
|
|
103
|
-
} = this.props;
|
|
104
|
-
const toValue = this.getAnimateToValue({
|
|
105
|
-
...this.props,
|
|
106
|
-
closing
|
|
43
|
+
export let Card = /*#__PURE__*/function (_React$Component) {
|
|
44
|
+
function Card(...args) {
|
|
45
|
+
var _this;
|
|
46
|
+
_classCallCheck(this, Card);
|
|
47
|
+
_this = _callSuper(this, Card, [...args]);
|
|
48
|
+
_defineProperty(_this, "isCurrentlyMounted", false);
|
|
49
|
+
_defineProperty(_this, "isClosing", new Animated.Value(FALSE));
|
|
50
|
+
_defineProperty(_this, "inverted", new Animated.Value(getInvertedMultiplier(_this.props.gestureDirection, _this.props.direction === 'rtl')));
|
|
51
|
+
_defineProperty(_this, "layout", {
|
|
52
|
+
width: new Animated.Value(_this.props.layout.width),
|
|
53
|
+
height: new Animated.Value(_this.props.layout.height)
|
|
107
54
|
});
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
this.handleStartInteraction();
|
|
114
|
-
clearTimeout(this.pendingGestureCallback);
|
|
115
|
-
onTransition?.({
|
|
55
|
+
_defineProperty(_this, "isSwiping", new Animated.Value(FALSE));
|
|
56
|
+
_defineProperty(_this, "interactionHandle", void 0);
|
|
57
|
+
_defineProperty(_this, "pendingGestureCallback", void 0);
|
|
58
|
+
_defineProperty(_this, "lastToValue", void 0);
|
|
59
|
+
_defineProperty(_this, "animate", ({
|
|
116
60
|
closing,
|
|
117
|
-
|
|
118
|
-
});
|
|
119
|
-
animation(gesture, {
|
|
120
|
-
...spec.config,
|
|
121
|
-
velocity,
|
|
122
|
-
toValue,
|
|
123
|
-
useNativeDriver,
|
|
124
|
-
isInteraction: false
|
|
125
|
-
}).start(({
|
|
126
|
-
finished
|
|
61
|
+
velocity
|
|
127
62
|
}) => {
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
63
|
+
const {
|
|
64
|
+
transitionSpec,
|
|
65
|
+
onOpen,
|
|
66
|
+
onClose,
|
|
67
|
+
onTransition,
|
|
68
|
+
gesture
|
|
69
|
+
} = _this.props;
|
|
70
|
+
const toValue = _this.getAnimateToValue({
|
|
71
|
+
..._this.props,
|
|
72
|
+
closing
|
|
73
|
+
});
|
|
74
|
+
_this.lastToValue = toValue;
|
|
75
|
+
_this.isClosing.setValue(closing ? TRUE : FALSE);
|
|
76
|
+
const spec = closing ? transitionSpec.close : transitionSpec.open;
|
|
77
|
+
const animation = spec.animation === 'spring' ? Animated.spring : Animated.timing;
|
|
78
|
+
_this.setPointerEventsEnabled(!closing);
|
|
79
|
+
_this.handleStartInteraction();
|
|
80
|
+
clearTimeout(_this.pendingGestureCallback);
|
|
81
|
+
onTransition?.({
|
|
82
|
+
closing,
|
|
83
|
+
gesture: velocity !== undefined
|
|
84
|
+
});
|
|
85
|
+
animation(gesture, {
|
|
86
|
+
...spec.config,
|
|
87
|
+
velocity,
|
|
88
|
+
toValue,
|
|
89
|
+
useNativeDriver,
|
|
90
|
+
isInteraction: false
|
|
91
|
+
}).start(({
|
|
92
|
+
finished
|
|
93
|
+
}) => {
|
|
94
|
+
_this.handleEndInteraction();
|
|
95
|
+
clearTimeout(_this.pendingGestureCallback);
|
|
96
|
+
if (finished) {
|
|
97
|
+
if (closing) {
|
|
98
|
+
onClose();
|
|
99
|
+
} else {
|
|
100
|
+
onOpen();
|
|
101
|
+
}
|
|
102
|
+
if (_this.isCurrentlyMounted) {
|
|
103
|
+
// Make sure to re-open screen if it wasn't removed
|
|
104
|
+
_this.forceUpdate();
|
|
105
|
+
}
|
|
139
106
|
}
|
|
140
|
-
}
|
|
107
|
+
});
|
|
141
108
|
});
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
closing,
|
|
145
|
-
layout,
|
|
146
|
-
gestureDirection,
|
|
147
|
-
direction,
|
|
148
|
-
preloaded
|
|
149
|
-
}) => {
|
|
150
|
-
if (!closing && !preloaded) {
|
|
151
|
-
return 0;
|
|
152
|
-
}
|
|
153
|
-
return getDistanceForDirection(layout, gestureDirection, direction === 'rtl');
|
|
154
|
-
};
|
|
155
|
-
setPointerEventsEnabled = enabled => {
|
|
156
|
-
const pointerEvents = enabled ? 'box-none' : 'none';
|
|
157
|
-
this.ref.current?.setPointerEvents(pointerEvents);
|
|
158
|
-
};
|
|
159
|
-
handleStartInteraction = () => {
|
|
160
|
-
if (this.interactionHandle === undefined) {
|
|
161
|
-
this.interactionHandle = InteractionManager.createInteractionHandle();
|
|
162
|
-
}
|
|
163
|
-
};
|
|
164
|
-
handleEndInteraction = () => {
|
|
165
|
-
if (this.interactionHandle !== undefined) {
|
|
166
|
-
InteractionManager.clearInteractionHandle(this.interactionHandle);
|
|
167
|
-
this.interactionHandle = undefined;
|
|
168
|
-
}
|
|
169
|
-
};
|
|
170
|
-
handleGestureStateChange = ({
|
|
171
|
-
nativeEvent
|
|
172
|
-
}) => {
|
|
173
|
-
const {
|
|
174
|
-
direction,
|
|
109
|
+
_defineProperty(_this, "getAnimateToValue", ({
|
|
110
|
+
closing,
|
|
175
111
|
layout,
|
|
176
|
-
onClose,
|
|
177
|
-
onGestureBegin,
|
|
178
|
-
onGestureCanceled,
|
|
179
|
-
onGestureEnd,
|
|
180
112
|
gestureDirection,
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
113
|
+
direction,
|
|
114
|
+
preloaded
|
|
115
|
+
}) => {
|
|
116
|
+
if (!closing && !preloaded) {
|
|
117
|
+
return 0;
|
|
118
|
+
}
|
|
119
|
+
return getDistanceForDirection(layout, gestureDirection, direction === 'rtl');
|
|
120
|
+
});
|
|
121
|
+
_defineProperty(_this, "setPointerEventsEnabled", enabled => {
|
|
122
|
+
const pointerEvents = enabled ? 'box-none' : 'none';
|
|
123
|
+
_this.ref.current?.setPointerEvents(pointerEvents);
|
|
124
|
+
});
|
|
125
|
+
_defineProperty(_this, "handleStartInteraction", () => {
|
|
126
|
+
if (_this.interactionHandle === undefined) {
|
|
127
|
+
_this.interactionHandle = InteractionManager.createInteractionHandle();
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
_defineProperty(_this, "handleEndInteraction", () => {
|
|
131
|
+
if (_this.interactionHandle !== undefined) {
|
|
132
|
+
InteractionManager.clearInteractionHandle(_this.interactionHandle);
|
|
133
|
+
_this.interactionHandle = undefined;
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
_defineProperty(_this, "handleGestureStateChange", ({
|
|
137
|
+
nativeEvent
|
|
138
|
+
}) => {
|
|
139
|
+
const {
|
|
140
|
+
direction,
|
|
141
|
+
layout,
|
|
142
|
+
onClose,
|
|
143
|
+
onGestureBegin,
|
|
144
|
+
onGestureCanceled,
|
|
145
|
+
onGestureEnd,
|
|
146
|
+
gestureDirection,
|
|
147
|
+
gestureVelocityImpact
|
|
148
|
+
} = _this.props;
|
|
149
|
+
switch (nativeEvent.state) {
|
|
150
|
+
case GestureState.ACTIVE:
|
|
151
|
+
_this.isSwiping.setValue(TRUE);
|
|
152
|
+
_this.handleStartInteraction();
|
|
153
|
+
onGestureBegin?.();
|
|
200
154
|
break;
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
distance = layout.width;
|
|
214
|
-
translation = nativeEvent.translationX;
|
|
215
|
-
velocity = nativeEvent.velocityX;
|
|
155
|
+
case GestureState.CANCELLED:
|
|
156
|
+
case GestureState.FAILED:
|
|
157
|
+
{
|
|
158
|
+
_this.isSwiping.setValue(FALSE);
|
|
159
|
+
_this.handleEndInteraction();
|
|
160
|
+
const velocity = gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? nativeEvent.velocityY : nativeEvent.velocityX;
|
|
161
|
+
_this.animate({
|
|
162
|
+
closing: _this.props.closing,
|
|
163
|
+
velocity
|
|
164
|
+
});
|
|
165
|
+
onGestureCanceled?.();
|
|
166
|
+
break;
|
|
216
167
|
}
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
168
|
+
case GestureState.END:
|
|
169
|
+
{
|
|
170
|
+
_this.isSwiping.setValue(FALSE);
|
|
171
|
+
let distance;
|
|
172
|
+
let translation;
|
|
173
|
+
let velocity;
|
|
174
|
+
if (gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted') {
|
|
175
|
+
distance = layout.height;
|
|
176
|
+
translation = nativeEvent.translationY;
|
|
177
|
+
velocity = nativeEvent.velocityY;
|
|
178
|
+
} else {
|
|
179
|
+
distance = layout.width;
|
|
180
|
+
translation = nativeEvent.translationX;
|
|
181
|
+
velocity = nativeEvent.velocityX;
|
|
182
|
+
}
|
|
183
|
+
const closing = (translation + velocity * gestureVelocityImpact) * getInvertedMultiplier(gestureDirection, direction === 'rtl') > distance / 2 ? velocity !== 0 || translation !== 0 : _this.props.closing;
|
|
184
|
+
_this.animate({
|
|
185
|
+
closing,
|
|
186
|
+
velocity
|
|
187
|
+
});
|
|
188
|
+
if (closing) {
|
|
189
|
+
// We call onClose with a delay to make sure that the animation has already started
|
|
190
|
+
// This will make sure that the state update caused by this doesn't affect start of animation
|
|
191
|
+
_this.pendingGestureCallback = setTimeout(() => {
|
|
192
|
+
onClose();
|
|
227
193
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
194
|
+
// Trigger an update after we dispatch the action to remove the screen
|
|
195
|
+
// This will make sure that we check if the screen didn't get removed so we can cancel the animation
|
|
196
|
+
_this.forceUpdate();
|
|
197
|
+
}, 32);
|
|
198
|
+
}
|
|
199
|
+
onGestureEnd?.();
|
|
200
|
+
break;
|
|
232
201
|
}
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
// Memoize this to avoid extra work on re-render
|
|
205
|
+
_defineProperty(_this, "getInterpolatedStyle", memoize((styleInterpolator, animation) => styleInterpolator(animation)));
|
|
206
|
+
// Keep track of the animation context when deps changes.
|
|
207
|
+
_defineProperty(_this, "getCardAnimation", memoize((interpolationIndex, current, next, layout, insetTop, insetRight, insetBottom, insetLeft) => ({
|
|
208
|
+
index: interpolationIndex,
|
|
209
|
+
current: {
|
|
210
|
+
progress: current
|
|
211
|
+
},
|
|
212
|
+
next: next && {
|
|
213
|
+
progress: next
|
|
214
|
+
},
|
|
215
|
+
closing: _this.isClosing,
|
|
216
|
+
swiping: _this.isSwiping,
|
|
217
|
+
inverted: _this.inverted,
|
|
218
|
+
layouts: {
|
|
219
|
+
screen: layout
|
|
220
|
+
},
|
|
221
|
+
insets: {
|
|
222
|
+
top: insetTop,
|
|
223
|
+
right: insetRight,
|
|
224
|
+
bottom: insetBottom,
|
|
225
|
+
left: insetLeft
|
|
226
|
+
}
|
|
227
|
+
})));
|
|
228
|
+
_defineProperty(_this, "ref", /*#__PURE__*/React.createRef());
|
|
229
|
+
return _this;
|
|
230
|
+
}
|
|
231
|
+
_inherits(Card, _React$Component);
|
|
232
|
+
return _createClass(Card, [{
|
|
233
|
+
key: "componentDidMount",
|
|
234
|
+
value: function componentDidMount() {
|
|
235
|
+
if (!this.props.preloaded) {
|
|
236
|
+
this.animate({
|
|
237
|
+
closing: this.props.closing
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
this.isCurrentlyMounted = true;
|
|
236
241
|
}
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
242
|
+
}, {
|
|
243
|
+
key: "componentDidUpdate",
|
|
244
|
+
value: function componentDidUpdate(prevProps) {
|
|
245
|
+
const {
|
|
246
|
+
direction,
|
|
247
|
+
layout,
|
|
248
|
+
gestureDirection,
|
|
249
|
+
closing
|
|
250
|
+
} = this.props;
|
|
251
|
+
const {
|
|
252
|
+
width,
|
|
253
|
+
height
|
|
254
|
+
} = layout;
|
|
255
|
+
if (width !== prevProps.layout.width) {
|
|
256
|
+
this.layout.width.setValue(width);
|
|
257
|
+
}
|
|
258
|
+
if (height !== prevProps.layout.height) {
|
|
259
|
+
this.layout.height.setValue(height);
|
|
260
|
+
}
|
|
261
|
+
if (gestureDirection !== prevProps.gestureDirection) {
|
|
262
|
+
this.inverted.setValue(getInvertedMultiplier(gestureDirection, direction === 'rtl'));
|
|
263
|
+
}
|
|
264
|
+
const toValue = this.getAnimateToValue(this.props);
|
|
265
|
+
if (this.getAnimateToValue(prevProps) !== toValue || this.lastToValue !== toValue) {
|
|
266
|
+
// We need to trigger the animation when route was closed
|
|
267
|
+
// The route might have been closed by a `POP` action or by a gesture
|
|
268
|
+
// When route was closed due to a gesture, the animation would've happened already
|
|
269
|
+
// It's still important to trigger the animation so that `onClose` is called
|
|
270
|
+
// If `onClose` is not called, cleanup step won't be performed for gestures
|
|
271
|
+
this.animate({
|
|
272
|
+
closing
|
|
273
|
+
});
|
|
274
|
+
}
|
|
262
275
|
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
} else if (gestureDirection === 'vertical-inverted') {
|
|
283
|
-
return {
|
|
284
|
-
maxDeltaX: 15,
|
|
285
|
-
minOffsetY: -5,
|
|
286
|
-
hitSlop: {
|
|
287
|
-
top: -layout.height + distance
|
|
288
|
-
},
|
|
289
|
-
enableTrackpadTwoFingerGesture
|
|
290
|
-
};
|
|
291
|
-
} else {
|
|
292
|
-
const hitSlop = -layout.width + distance;
|
|
293
|
-
const invertedMultiplier = getInvertedMultiplier(gestureDirection, direction === 'rtl');
|
|
294
|
-
if (invertedMultiplier === 1) {
|
|
276
|
+
}, {
|
|
277
|
+
key: "componentWillUnmount",
|
|
278
|
+
value: function componentWillUnmount() {
|
|
279
|
+
this.props.gesture?.stopAnimation();
|
|
280
|
+
this.isCurrentlyMounted = false;
|
|
281
|
+
this.handleEndInteraction();
|
|
282
|
+
}
|
|
283
|
+
}, {
|
|
284
|
+
key: "gestureActivationCriteria",
|
|
285
|
+
value: function gestureActivationCriteria() {
|
|
286
|
+
const {
|
|
287
|
+
direction,
|
|
288
|
+
layout,
|
|
289
|
+
gestureDirection,
|
|
290
|
+
gestureResponseDistance
|
|
291
|
+
} = this.props;
|
|
292
|
+
const enableTrackpadTwoFingerGesture = true;
|
|
293
|
+
const distance = gestureResponseDistance !== undefined ? gestureResponseDistance : gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? GESTURE_RESPONSE_DISTANCE_VERTICAL : GESTURE_RESPONSE_DISTANCE_HORIZONTAL;
|
|
294
|
+
if (gestureDirection === 'vertical') {
|
|
295
295
|
return {
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
maxDeltaX: 15,
|
|
297
|
+
minOffsetY: 5,
|
|
298
298
|
hitSlop: {
|
|
299
|
-
|
|
299
|
+
bottom: -layout.height + distance
|
|
300
300
|
},
|
|
301
301
|
enableTrackpadTwoFingerGesture
|
|
302
302
|
};
|
|
303
|
-
} else {
|
|
303
|
+
} else if (gestureDirection === 'vertical-inverted') {
|
|
304
304
|
return {
|
|
305
|
-
|
|
306
|
-
|
|
305
|
+
maxDeltaX: 15,
|
|
306
|
+
minOffsetY: -5,
|
|
307
307
|
hitSlop: {
|
|
308
|
-
|
|
308
|
+
top: -layout.height + distance
|
|
309
309
|
},
|
|
310
310
|
enableTrackpadTwoFingerGesture
|
|
311
311
|
};
|
|
312
|
+
} else {
|
|
313
|
+
const hitSlop = -layout.width + distance;
|
|
314
|
+
const invertedMultiplier = getInvertedMultiplier(gestureDirection, direction === 'rtl');
|
|
315
|
+
if (invertedMultiplier === 1) {
|
|
316
|
+
return {
|
|
317
|
+
minOffsetX: 5,
|
|
318
|
+
maxDeltaY: 20,
|
|
319
|
+
hitSlop: {
|
|
320
|
+
right: hitSlop
|
|
321
|
+
},
|
|
322
|
+
enableTrackpadTwoFingerGesture
|
|
323
|
+
};
|
|
324
|
+
} else {
|
|
325
|
+
return {
|
|
326
|
+
minOffsetX: -5,
|
|
327
|
+
maxDeltaY: 20,
|
|
328
|
+
hitSlop: {
|
|
329
|
+
left: hitSlop
|
|
330
|
+
},
|
|
331
|
+
enableTrackpadTwoFingerGesture
|
|
332
|
+
};
|
|
333
|
+
}
|
|
312
334
|
}
|
|
313
335
|
}
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
backgroundColor
|
|
368
|
-
} = StyleSheet.flatten(contentStyle || {});
|
|
369
|
-
const isTransparent = typeof backgroundColor === 'string' ? Color(backgroundColor).alpha() === 0 : false;
|
|
370
|
-
return /*#__PURE__*/React.createElement(CardAnimationContext.Provider, {
|
|
371
|
-
value: interpolationProps
|
|
372
|
-
}, /*#__PURE__*/React.createElement(Animated.View, {
|
|
373
|
-
style: {
|
|
374
|
-
// This is a dummy style that doesn't actually change anything visually.
|
|
375
|
-
// Animated needs the animated value to be used somewhere, otherwise things don't update properly.
|
|
376
|
-
// If we disable animations and hide header, it could end up making the value unused.
|
|
377
|
-
// So we have this dummy style that will always be used regardless of what else changed.
|
|
378
|
-
opacity: current
|
|
379
|
-
}
|
|
380
|
-
// Make sure that this view isn't removed. If this view is removed, our style with animated value won't apply
|
|
381
|
-
,
|
|
382
|
-
collapsable: false
|
|
383
|
-
}), /*#__PURE__*/React.createElement(View, _extends({
|
|
384
|
-
pointerEvents: "box-none"
|
|
385
|
-
// Make sure this view is not removed on the new architecture, as it causes focus loss during navigation on Android.
|
|
386
|
-
// This can happen when the view flattening results in different trees - due to `overflow` style changing in a parent.
|
|
387
|
-
,
|
|
388
|
-
collapsable: false
|
|
389
|
-
}, rest), overlayEnabled ? /*#__PURE__*/React.createElement(View, {
|
|
390
|
-
pointerEvents: "box-none",
|
|
391
|
-
style: StyleSheet.absoluteFill
|
|
392
|
-
}, overlay({
|
|
393
|
-
style: overlayStyle
|
|
394
|
-
})) : null, /*#__PURE__*/React.createElement(Animated.View, {
|
|
395
|
-
style: [styles.container, containerStyle, customContainerStyle],
|
|
396
|
-
pointerEvents: "box-none"
|
|
397
|
-
}, /*#__PURE__*/React.createElement(PanGestureHandler, _extends({
|
|
398
|
-
enabled: layout.width !== 0 && gestureEnabled,
|
|
399
|
-
onGestureEvent: handleGestureEvent,
|
|
400
|
-
onHandlerStateChange: this.handleGestureStateChange
|
|
401
|
-
}, this.gestureActivationCriteria()), /*#__PURE__*/React.createElement(Animated.View, {
|
|
402
|
-
needsOffscreenAlphaCompositing: hasOpacityStyle(cardStyle),
|
|
403
|
-
style: [styles.container, cardStyle]
|
|
404
|
-
}, shadowEnabled && shadowStyle && !isTransparent ? /*#__PURE__*/React.createElement(Animated.View, {
|
|
405
|
-
style: [styles.shadow, gestureDirection === 'horizontal' ? [styles.shadowHorizontal, styles.shadowStart] : gestureDirection === 'horizontal-inverted' ? [styles.shadowHorizontal, styles.shadowEnd] : gestureDirection === 'vertical' ? [styles.shadowVertical, styles.shadowTop] : [styles.shadowVertical, styles.shadowBottom], {
|
|
336
|
+
}, {
|
|
337
|
+
key: "render",
|
|
338
|
+
value: function render() {
|
|
339
|
+
const {
|
|
340
|
+
styleInterpolator,
|
|
341
|
+
interpolationIndex,
|
|
342
|
+
current,
|
|
343
|
+
gesture,
|
|
344
|
+
next,
|
|
345
|
+
layout,
|
|
346
|
+
insets,
|
|
347
|
+
overlay,
|
|
348
|
+
overlayEnabled,
|
|
349
|
+
shadowEnabled,
|
|
350
|
+
gestureEnabled,
|
|
351
|
+
gestureDirection,
|
|
352
|
+
pageOverflowEnabled,
|
|
353
|
+
children,
|
|
354
|
+
containerStyle: customContainerStyle,
|
|
355
|
+
contentStyle,
|
|
356
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
357
|
+
closing,
|
|
358
|
+
direction,
|
|
359
|
+
gestureResponseDistance,
|
|
360
|
+
gestureVelocityImpact,
|
|
361
|
+
onClose,
|
|
362
|
+
onGestureBegin,
|
|
363
|
+
onGestureCanceled,
|
|
364
|
+
onGestureEnd,
|
|
365
|
+
onOpen,
|
|
366
|
+
onTransition,
|
|
367
|
+
transitionSpec,
|
|
368
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
369
|
+
...rest
|
|
370
|
+
} = this.props;
|
|
371
|
+
const interpolationProps = this.getCardAnimation(interpolationIndex, current, next, layout, insets.top, insets.right, insets.bottom, insets.left);
|
|
372
|
+
const interpolatedStyle = this.getInterpolatedStyle(styleInterpolator, interpolationProps);
|
|
373
|
+
const {
|
|
374
|
+
containerStyle,
|
|
375
|
+
cardStyle,
|
|
376
|
+
overlayStyle,
|
|
377
|
+
shadowStyle
|
|
378
|
+
} = interpolatedStyle;
|
|
379
|
+
const handleGestureEvent = gestureEnabled ? Animated.event([{
|
|
380
|
+
nativeEvent: gestureDirection === 'vertical' || gestureDirection === 'vertical-inverted' ? {
|
|
381
|
+
translationY: gesture
|
|
382
|
+
} : {
|
|
383
|
+
translationX: gesture
|
|
384
|
+
}
|
|
385
|
+
}], {
|
|
386
|
+
useNativeDriver
|
|
387
|
+
}) : undefined;
|
|
388
|
+
const {
|
|
406
389
|
backgroundColor
|
|
407
|
-
}
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
390
|
+
} = StyleSheet.flatten(contentStyle || {});
|
|
391
|
+
const isTransparent = typeof backgroundColor === 'string' ? Color(backgroundColor).alpha() === 0 : false;
|
|
392
|
+
return /*#__PURE__*/_jsxs(CardAnimationContext.Provider, {
|
|
393
|
+
value: interpolationProps,
|
|
394
|
+
children: [/*#__PURE__*/_jsx(Animated.View, {
|
|
395
|
+
style: {
|
|
396
|
+
// This is a dummy style that doesn't actually change anything visually.
|
|
397
|
+
// Animated needs the animated value to be used somewhere, otherwise things don't update properly.
|
|
398
|
+
// If we disable animations and hide header, it could end up making the value unused.
|
|
399
|
+
// So we have this dummy style that will always be used regardless of what else changed.
|
|
400
|
+
opacity: current
|
|
401
|
+
}
|
|
402
|
+
// Make sure that this view isn't removed. If this view is removed, our style with animated value won't apply
|
|
403
|
+
,
|
|
404
|
+
collapsable: false
|
|
405
|
+
}), /*#__PURE__*/_jsxs(View, {
|
|
406
|
+
pointerEvents: "box-none"
|
|
407
|
+
// Make sure this view is not removed on the new architecture, as it causes focus loss during navigation on Android.
|
|
408
|
+
// This can happen when the view flattening results in different trees - due to `overflow` style changing in a parent.
|
|
409
|
+
,
|
|
410
|
+
collapsable: false,
|
|
411
|
+
...rest,
|
|
412
|
+
children: [overlayEnabled ? /*#__PURE__*/_jsx(View, {
|
|
413
|
+
pointerEvents: "box-none",
|
|
414
|
+
style: StyleSheet.absoluteFill,
|
|
415
|
+
children: overlay({
|
|
416
|
+
style: overlayStyle
|
|
417
|
+
})
|
|
418
|
+
}) : null, /*#__PURE__*/_jsx(Animated.View, {
|
|
419
|
+
style: [styles.container, containerStyle, customContainerStyle],
|
|
420
|
+
pointerEvents: "box-none",
|
|
421
|
+
children: /*#__PURE__*/_jsx(PanGestureHandler, {
|
|
422
|
+
enabled: layout.width !== 0 && gestureEnabled,
|
|
423
|
+
onGestureEvent: handleGestureEvent,
|
|
424
|
+
onHandlerStateChange: this.handleGestureStateChange,
|
|
425
|
+
...this.gestureActivationCriteria(),
|
|
426
|
+
children: /*#__PURE__*/_jsxs(Animated.View, {
|
|
427
|
+
needsOffscreenAlphaCompositing: hasOpacityStyle(cardStyle),
|
|
428
|
+
style: [styles.container, cardStyle],
|
|
429
|
+
children: [shadowEnabled && shadowStyle && !isTransparent ? /*#__PURE__*/_jsx(Animated.View, {
|
|
430
|
+
style: [styles.shadow, gestureDirection === 'horizontal' ? [styles.shadowHorizontal, styles.shadowStart] : gestureDirection === 'horizontal-inverted' ? [styles.shadowHorizontal, styles.shadowEnd] : gestureDirection === 'vertical' ? [styles.shadowVertical, styles.shadowTop] : [styles.shadowVertical, styles.shadowBottom], {
|
|
431
|
+
backgroundColor
|
|
432
|
+
}, shadowStyle],
|
|
433
|
+
pointerEvents: "none"
|
|
434
|
+
}) : null, /*#__PURE__*/_jsx(CardSheet, {
|
|
435
|
+
ref: this.ref,
|
|
436
|
+
enabled: pageOverflowEnabled,
|
|
437
|
+
layout: layout,
|
|
438
|
+
style: contentStyle,
|
|
439
|
+
children: children
|
|
440
|
+
})]
|
|
441
|
+
})
|
|
442
|
+
})
|
|
443
|
+
})]
|
|
444
|
+
})]
|
|
445
|
+
});
|
|
446
|
+
}
|
|
447
|
+
}]);
|
|
448
|
+
}(React.Component);
|
|
449
|
+
_defineProperty(Card, "defaultProps", {
|
|
450
|
+
shadowEnabled: false,
|
|
451
|
+
gestureEnabled: true,
|
|
452
|
+
gestureVelocityImpact: GESTURE_VELOCITY_IMPACT,
|
|
453
|
+
overlay: ({
|
|
454
|
+
style
|
|
455
|
+
}) => style ? /*#__PURE__*/_jsx(Animated.View, {
|
|
456
|
+
pointerEvents: "none",
|
|
457
|
+
style: [styles.overlay, style]
|
|
458
|
+
}) : null
|
|
459
|
+
});
|
|
417
460
|
const styles = StyleSheet.create({
|
|
418
461
|
container: {
|
|
419
462
|
flex: 1
|