You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1 line
44 KiB

{"ast":null,"code":"import _defineProperty2 from \"@babel/runtime/helpers/defineProperty\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _assertThisInitialized from \"@babel/runtime/helpers/assertThisInitialized\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _possibleConstructorReturn from \"@babel/runtime/helpers/possibleConstructorReturn\";\nimport _getPrototypeOf from \"@babel/runtime/helpers/getPrototypeOf\";\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty2(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }\nfunction _extends() {\n _extends = Object.assign || function (target) {\n for (var i = 1; i < arguments.length; i++) {\n var source = arguments[i];\n for (var key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n target[key] = source[key];\n }\n }\n }\n return target;\n };\n return _extends.apply(this, arguments);\n}\nfunction _defineProperty(obj, key, value) {\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}\nimport * as React from 'react';\nimport { Component } from 'react';\nimport Animated from \"react-native-web/dist/exports/Animated\";\nimport StyleSheet from \"react-native-web/dist/exports/StyleSheet\";\nimport View from \"react-native-web/dist/exports/View\";\nimport I18nManager from \"react-native-web/dist/exports/I18nManager\";\nimport { PanGestureHandler } from \"../handlers/PanGestureHandler\";\nimport { TapGestureHandler } from \"../handlers/TapGestureHandler\";\nimport { State } from \"../State\";\nvar DRAG_TOSS = 0.05;\nvar Swipeable = function (_Component) {\n _inherits(Swipeable, _Component);\n var _super = _createSuper(Swipeable);\n function Swipeable(_props) {\n var _this;\n _classCallCheck(this, Swipeable);\n _this = _super.call(this, _props);\n _defineProperty(_assertThisInitialized(_this), \"onGestureEvent\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"transX\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"showLeftAction\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"leftActionTranslate\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"showRightAction\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"rightActionTranslate\", void 0);\n _defineProperty(_assertThisInitialized(_this), \"updateAnimatedEvent\", function (props, state) {\n var friction = props.friction,\n overshootFriction = props.overshootFriction;\n var dragX = state.dragX,\n rowTranslation = state.rowTranslation,\n _state$leftWidth = state.leftWidth,\n leftWidth = _state$leftWidth === void 0 ? 0 : _state$leftWidth,\n _state$rowWidth = state.rowWidth,\n rowWidth = _state$rowWidth === void 0 ? 0 : _state$rowWidth;\n var _state$rightOffset = state.rightOffset,\n rightOffset = _state$rightOffset === void 0 ? rowWidth : _state$rightOffset;\n var rightWidth = Math.max(0, rowWidth - rightOffset);\n var _props$overshootLeft = props.overshootLeft,\n overshootLeft = _props$overshootLeft === void 0 ? leftWidth > 0 : _props$overshootLeft,\n _props$overshootRight = props.overshootRight,\n overshootRight = _props$overshootRight === void 0 ? rightWidth > 0 : _props$overshootRight;\n var transX = Animated.add(rowTranslation, dragX.interpolate({\n inputRange: [0, friction],\n outputRange: [0, 1]\n })).interpolate({\n inputRange: [-rightWidth - 1, -rightWidth, leftWidth, leftWidth + 1],\n outputRange: [-rightWidth - (overshootRight ? 1 / overshootFriction : 0), -rightWidth, leftWidth, leftWidth + (overshootLeft ? 1 / overshootFriction : 0)]\n });\n _this.transX = transX;\n _this.showLeftAction = leftWidth > 0 ? transX.interpolate({\n inputRange: [-1, 0, leftWidth],\n outputRange: [0, 0, 1]\n }) : new Animated.Value(0);\n _this.leftActionTranslate = _this.showLeftAction.interpolate({\n inputRange: [0, Number.MIN_VALUE],\n outputRange: [-10000, 0],\n extrapolate: 'clamp'\n });\n _this.showRightAction = rightWidth > 0 ? transX.interpolate({\n inputRange: [-rightWidth, 0, 1],\n outputRange: [1, 0, 0]\n }) : new Animated.Value(0);\n _this.rightActionTranslate = _this.showRightAction.interpolate({\n inputRange: [0, Number.MIN_VALUE],\n outputRange: [-10000, 0],\n extrapolate: 'clamp'\n });\n });\n _defineProperty(_assertThisInitialized(_this), \"onTapHandlerStateChange\", function (_ref) {\n var nativeEvent = _ref.nativeEvent;\n if (nativeEvent.oldState === State.ACTIVE) {\n _this.close();\n }\n });\n _defineProperty(_assertThisInitialized(_this), \"onHandlerStateChange\", function (ev) {\n if (ev.nativeEvent.oldState === State.ACTIVE) {\n _this.handleRelease(ev);\n }\n });\n _defineProperty(_assertThisInitialized(_this), \"handleRelease\", function (ev) {\n var _ev$nativeEvent = ev.nativeEvent,\n velocityX = _ev$nativeEvent.velocityX,\n dragX = _ev$nativeEvent.translationX;\n var _this$state = _this.state,\n _this$state$leftWidth = _this$state.leftWidth,\n leftWidth = _this$state$leftWidth === void 0 ? 0 : _this$state$leftWidth,\n _this$state$rowWidth = _this$state.rowWidth,\n rowWidth = _this$state$rowWidth === void 0 ? 0 : _this$state$rowWidth,\n rowState = _this$state.rowState;\n var _this$state$rightOffs = _this.state.rightOffset,\n rightOffset = _this$state$rightOffs === void 0 ? rowWidth : _this$state$rightOffs;\n var rightWidth = rowWidth - rightOffset;\n var _this$props11 = _this.props,\n friction = _this$props11.friction,\n _this$props11$leftThr = _this$props11.leftThreshold,\n leftThreshold = _this$props11$leftThr === void 0 ? leftWidth / 2 : _this$props11$leftThr,\n _this$props11$rightTh = _this$props11.rightThreshold,\n rightThreshold = _this$props11$rightTh === void 0 ? rightWidth / 2 : _this$props11$rightTh;\n var startOffsetX = _this.currentOffset() + dragX / friction;\n var translationX = (dragX + DRAG_TOSS * velocityX) / friction;\n var toValue = 0;\n if (rowState === 0) {\n if (translationX > leftThreshold) {\n toValue = leftWidth;\n } else if (translationX < -rightThreshold) {\n toValue = -rightWidth;\n }\n } else if (rowState === 1) {\n if (translationX > -leftThreshold) {\n toValue = leftWidth;\n }\n } else {\n if (translationX < rightThreshold) {\n toValue = -rightWidth;\n }\n }\n _this.animateRow(startOffsetX, toValue, velocityX / friction);\n });\n _defineProperty(_assertThisInitialized(_this), \"animateRow\", function (fromValue, toValue, velocityX) {\n var _this$state2 = _this.state,\n dragX = _this$state2.dragX,\n rowTranslation = _this$state2.rowTranslation;\n dragX.setValue(0);\n rowTranslation.setValue(fromValue);\n _this.setState({\n rowState: Math.sign(toValue)\n });\n Animated.spring(rowTranslation, _objectSpread({\n restSpeedThreshold: 1.7,\n restDisplacementThreshold: 0.4,\n velocity: velocityX,\n bounciness: 0,\n toValue: toValue,\n useNativeDriver: _this.props.useNativeAnimations\n }, _this.props.animationOptions)).start(function (_ref2) {\n var finished = _ref2.finished;\n if (finished) {\n if (toValue > 0) {\n var _this$props$onSwipeab, _this$props, _this$props$onSwipeab2, _this$props2;\n (_this$props$onSwipeab = (_this$props = _this.props).onSwipeableLeftOpen) === null || _this$props$onSwipeab === void 0 ? void 0 : _this$props$onSwipeab.call(_this$props);\n (_this$props$onSwipeab2 = (_this$props2 = _this.props).onSwipeableOpen) === null || _this$props$onSwipeab2 === void 0 ? void 0 : _this$props$onSwipeab2.call(_this$props2, 'left', _assertThisInitialized(_this));\n } else if (toValue < 0) {\n var _this$props$onSwipeab3, _this$props3, _this$props$onSwipeab4, _this$props4;\n (_this$props$onSwipeab3 = (_this$props3 = _this.props).onSwipeableRightOpen) === null || _this$props$onSwipeab3 === void 0 ? void 0 : _this$props$onSwipeab3.call(_this$props3);\n (_this$props$onSwipeab4 = (_this$props4 = _this.props).onSwipeableOpen) === null || _this$props$onSwipeab4 === void 0 ? void 0 : _this$props$onSwipeab4.call(_this$props4, 'right', _assertThisInitialized(_this));\n } else {\n var _this$props$onSwipeab5, _this$props5;\n var closingDirection = fromValue > 0 ? 'left' : 'right';\n (_this$props$onSwipeab5 = (_this$props5 = _this.props).onSwipeableClose) === null || _this$props$onSwipeab5 === void 0 ? void 0 : _this$props$onSwipeab5.call(_this$props5, closingDirection, _assertThisInitialized(_this));\n }\n }\n });\n if (toValue > 0) {\n var _this$props$onSwipeab6, _this$props6, _this$props$onSwipeab7, _this$props7;\n (_this$props$onSwipeab6 = (_this$props6 = _this.props).onSwipeableLeftWillOpen) === null || _this$props$onSwipeab6 === void 0 ? void 0 : _this$props$onSwipeab6.call(_this$props6);\n (_this$props$onSwipeab7 = (_this$props7 = _this.props).onSwipeableWillOpen) === null || _this$props$onSwipeab7 === void 0 ? void 0 : _this$props$onSwipeab7.call(_this$props7, 'left');\n } else if (toValue < 0) {\n var _this$props$onSwipeab8, _this$props8, _this$props$onSwipeab9, _this$props9;\n (_this$props$onSwipeab8 = (_this$props8 = _this.props).onSwipeableRightWillOpen) === null || _this$props$onSwipeab8 === void 0 ? void 0 : _this$props$onSwipeab8.call(_this$props8);\n (_this$props$onSwipeab9 = (_this$props9 = _this.props).onSwipeableWillOpen) === null || _this$props$onSwipeab9 === void 0 ? void 0 : _this$props$onSwipeab9.call(_this$props9, 'right');\n } else {\n var _this$props$onSwipeab10, _this$props10;\n var closingDirection = fromValue > 0 ? 'left' : 'right';\n (_this$props$onSwipeab10 = (_this$props10 = _this.props).onSwipeableWillClose) === null || _this$props$onSwipeab10 === void 0 ? void 0 : _this$props$onSwipeab10.call(_this$props10, closingDirection);\n }\n });\n _defineProperty(_assertThisInitialized(_this), \"onRowLayout\", function (_ref3) {\n var nativeEvent = _ref3.nativeEvent;\n _this.setState({\n rowWidth: nativeEvent.layout.width\n });\n });\n _defineProperty(_assertThisInitialized(_this), \"currentOffset\", function () {\n var _this$state3 = _this.state,\n _this$state3$leftWidt = _this$state3.leftWidth,\n leftWidth = _this$state3$leftWidt === void 0 ? 0 : _this$state3$leftWidt,\n _this$state3$rowWidth = _this$state3.rowWidth,\n rowWidth = _this$state3$rowWidth === void 0 ? 0 : _this$state3$rowWidth,\n rowState = _this$state3.rowState;\n var _this$state$rightOffs2 = _this.state.rightOffset,\n rightOffset = _this$state$rightOffs2 === void 0 ? rowWidth : _this$state$rightOffs2;\n var rightWidth = rowWidth - rightOffset;\n if (rowState === 1) {\n return leftWidth;\n } else if (rowState === -1) {\n return -rightWidth;\n }\n return 0;\n });\n _defineProperty(_assertThisInitialized(_this), \"close\", function () {\n _this.animateRow(_this.currentOffset(), 0);\n });\n _defineProperty(_assertThisInitialized(_this), \"openLeft\", function () {\n var _this$state$leftWidth2 = _this.state.leftWidth,\n leftWidth = _this$state$leftWidth2 === void 0 ? 0 : _this$state$leftWidth2;\n _this.animateRow(_this.currentOffset(), leftWidth);\n });\n _defineProperty(_assertThisInitialized(_this), \"openRight\", function () {\n var _this$state$rowWidth2 = _this.state.rowWidth,\n rowWidth = _this$state$rowWidth2 === void 0 ? 0 : _this$state$rowWidth2;\n var _this$state$rightOffs3 = _this.state.rightOffset,\n rightOffset = _this$state$rightOffs3 === void 0 ? rowWidth : _this$state$rightOffs3;\n var rightWidth = rowWidth - rightOffset;\n _this.animateRow(_this.currentOffset(), -rightWidth);\n });\n var _dragX = new Animated.Value(0);\n _this.state = {\n dragX: _dragX,\n rowTranslation: new Animated.Value(0),\n rowState: 0,\n leftWidth: undefined,\n rightOffset: undefined,\n rowWidth: undefined\n };\n _this.updateAnimatedEvent(_props, _this.state);\n _this.onGestureEvent = Animated.event([{\n nativeEvent: {\n translationX: _dragX\n }\n }], {\n useNativeDriver: _props.useNativeAnimations\n });\n return _this;\n }\n _createClass(Swipeable, [{\n key: \"shouldComponentUpdate\",\n value: function shouldComponentUpdate(props, state) {\n if (this.props.friction !== props.friction || this.props.overshootLeft !== props.overshootLeft || this.props.overshootRight !== props.overshootRight || this.props.overshootFriction !== props.overshootFriction || this.state.leftWidth !== state.leftWidth || this.state.rightOffset !== state.rightOffset || this.state.rowWidth !== state.rowWidth) {\n this.updateAnimatedEvent(props, state);\n }\n return true;\n }\n }, {\n key: \"render\",\n value: function render() {\n var _this2 = this;\n var rowState = this.state.rowState;\n var _this$props12 = this.props,\n children = _this$props12.children,\n renderLeftActions = _this$props12.renderLeftActions,\n renderRightActions = _this$props12.renderRightActions;\n var left = renderLeftActions && React.createElement(Animated.View, {\n style: [styles.leftActions, {\n transform: [{\n translateX: this.leftActionTranslate\n }]\n }]\n }, renderLeftActions(this.showLeftAction, this.transX), React.createElement(View, {\n onLayout: function onLayout(_ref4) {\n var nativeEvent = _ref4.nativeEvent;\n return _this2.setState({\n leftWidth: nativeEvent.layout.x\n });\n }\n }));\n var right = renderRightActions && React.createElement(Animated.View, {\n style: [styles.rightActions, {\n transform: [{\n translateX: this.rightActionTranslate\n }]\n }]\n }, renderRightActions(this.showRightAction, this.transX, this), React.createElement(View, {\n onLayout: function onLayout(_ref5) {\n var nativeEvent = _ref5.nativeEvent;\n return _this2.setState({\n rightOffset: nativeEvent.layout.x\n });\n }\n }));\n return React.createElement(PanGestureHandler, _extends({\n activeOffsetX: [-10, 10]\n }, this.props, {\n onGestureEvent: this.onGestureEvent,\n onHandlerStateChange: this.onHandlerStateChange\n }), React.createElement(Animated.View, {\n onLayout: this.onRowLayout,\n style: [styles.container, this.props.containerStyle]\n }, left, right, React.createElement(TapGestureHandler, {\n enabled: rowState !== 0,\n onHandlerStateChange: this.onTapHandlerStateChange\n }, React.createElement(Animated.View, {\n pointerEvents: rowState === 0 ? 'auto' : 'box-only',\n style: [{\n transform: [{\n translateX: this.transX\n }]\n }, this.props.childrenContainerStyle]\n }, children))));\n }\n }]);\n return Swipeable;\n}(Component);\nexport { Swipeable as default };\n_defineProperty(Swipeable, \"defaultProps\", {\n friction: 1,\n overshootFriction: 1,\n useNativeAnimations: true\n});\nvar styles = StyleSheet.create({\n container: {\n overflow: 'hidden'\n },\n leftActions: _objectSpread(_objectSpread({}, StyleSheet.absoluteFillObject), {}, {\n flexDirection: I18nManager.isRTL ? 'row-reverse' : 'row'\n }),\n rightActions: _objectSpread(_objectSpread({}, StyleSheet.absoluteFillObject), {}, {\n flexDirection: I18nManager.isRTL ? 'row' : 'row-reverse'\n })\n});","map":{"version":3,"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;AACA,SAASC,SAAT,QAA0B,OAA1B;AAAA;AAAA;AAAA;AAAA;AAeA,SACEC,iBADF;AAKA,SACEC,iBADF;AAIA,SAASC,KAAT;AAEA,IAAMC,SAAS,GAAG,IAAlB;AAAA,IA0KqBC,SAAN;EAAA;EAAA;EAUbC,mBAAYC,MAAD,EAAwB;IAAA;IAAA;IACjC,0BAAMA,MAAN;IADiCC;IAAAA;IAAAA;IAAAA;IAAAA;IAAAA;IAAAA,sEA4CL,UAC5BD,KAD4B,EAE5BE,KAF4B,EAGzB;MACH,IAAQC,QAAF,GAAkCH,KAAxC,CAAQG,QAAF;QAAYC,oBAAsBJ,KAAxC,CAAkBI;MAClB,IAAQC,KAAF,GAAyDH,KAA/D,CA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ructor","props","_defineProperty","state","friction","overshootFriction","dragX","rowTranslation","leftWidth","rowWidth","rightOffset","rightWidth","Math","max","overshootLeft","overshootRight","transX","Animated","add","interpolate","inputRange","outputRange","showLeftAction","Value","leftActionTranslate","Number","MIN_VALUE","extrapolate","showRightAction","rightActionTranslate","nativeEvent","oldState","ACTIVE","close","ev","handleRelease","velocityX","translationX","rowState","leftThreshold","rightThreshold","startOffsetX","currentOffset","toValue","animateRow","fromValue","setValue","setState","sign","spring","restSpeedThreshold","restDisplacementThreshold","velocity","bounciness","useNativeDriver","useNativeAnimations","animationOptions","start","finished","onSwipeableLeftOpen","onSwipeableOpen","onSwipeableRightOpen","closingDirection","onSwipeableClose","onSwipeableLeftWillOpen","onSwipeableWillOpen","onSwipeableRightWillOpen","onSwipeableWillClose","layout","width","undefined","updateAnimatedEvent","onGestureEvent","event","shouldComponentUpdate","render","children","renderLeftActions","renderRightActions","left","View","style","styles","leftActions","transform","translateX","onLayout","x","right","rightActions","activeOffsetX","onHandlerStateChange","onRowLayout","container","containerStyle","enabled","onTapHandlerStateChange","pointerEvents","childrenContainerStyle","StyleSheet","create","overflow","absoluteFillObject","flexDirection","I18nManager","isRTL"],"sources":["/Users/mathildejean/Documents/BUT/LaSuperMeteo/LaSuperMeteo/iut-expo-starter/node_modules/react-native-gesture-handler/lib/module/components/Swipeable.tsx"],"sourcesContent":["// Similarily to the DrawerLayout component this deserves to be put in a\n// separate repo. Although, keeping it here for the time being will allow us to\n// move faster and fix possible issues quicker\n\nimport * as React from 'react';\nimport { Component } from 'react';\nimport {\n Animated,\n StyleSheet,\n View,\n I18nManager,\n LayoutChangeEvent,\n StyleProp,\n ViewStyle,\n} from 'react-native';\n\nimport {\n GestureEvent,\n HandlerStateChangeEvent,\n} from '../handlers/gestureHandlerCommon';\nimport {\n PanGestureHandler,\n PanGestureHandlerEventPayload,\n PanGestureHandlerProps,\n} from '../handlers/PanGestureHandler';\nimport {\n TapGestureHandler,\n TapGestureHandlerEventPayload,\n} from '../handlers/TapGestureHandler';\nimport { State } from '../State';\n\nconst DRAG_TOSS = 0.05;\n\ntype SwipeableExcludes = Exclude<\n keyof PanGestureHandlerProps,\n 'onGestureEvent' | 'onHandlerStateChange'\n>;\n\n// Animated.AnimatedInterpolation has been converted to a generic type\n// in @types/react-native 0.70. This way we can maintain compatibility\n// with all versions of @types/react-native\ntype AnimatedInterpolation = ReturnType<Animated.Value['interpolate']>;\n\nexport interface SwipeableProps\n extends Pick<PanGestureHandlerProps, SwipeableExcludes> {\n /**\n * Enables two-finger gestures on supported devices, for example iPads with\n * trackpads. If not enabled the gesture will require click + drag, with\n * `enableTrackpadTwoFingerGesture` swiping with two fingers will also trigger\n * the gesture.\n */\n enableTrackpadTwoFingerGesture?: boolean;\n\n /**\n * Specifies how much the visual interaction will be delayed compared to the\n * gesture distance. e.g. value of 1 will indicate that the swipeable panel\n * should exactly follow the gesture, 2 means it is going to be two times\n * \"slower\".\n */\n friction?: number;\n\n /**\n * Distance from the left edge at which released panel will animate to the\n * open state (or the open panel will animate into the closed state). By\n * default it's a half of the panel's width.\n */\n leftThreshold?: number;\n\n /**\n * Distance from the right edge at which released panel will animate to the\n * open state (or the open panel will animate into the closed state). By\n * default it's a half of the panel's width.\n */\n rightThreshold?: number;\n\n /**\n * Value indicating if the swipeable panel can be pulled further than the left\n * actions panel's width. It is set to true by default as long as the left\n * panel render method is present.\n */\n overshootLeft?: boolean;\n\n /**\n * Value indicating if the swipeable panel can be pulled further than the\n * right actions panel's width. It is set to true by default as long as the\n * right panel render method is present.\n */\n overshootRight?: boolean;\n\n /**\n * Specifies how much the visual interaction will be delayed compared to the\n * gesture distance at overshoot. Default value is 1, it mean no friction, for\n * a native feel, try 8 or above.\n */\n overshootFriction?: number;\n\n /**\n * @deprecated Use `direction` argument of onSwipeableOpen()\n *\n * Called when left action panel gets open.\n */\n onSwipeableLeftOpen?: () => void;\n\n /**\n * @deprecated Use `direction` argument of onSwipeableOpen()\n *\n * Called when right action panel gets open.\n */\n onSwipeableRightOpen?: () => void;\n\n /**\n * Called when action panel gets open (either right or left).\n */\n onSwipeableOpen?: (direction: 'left' | 'right', swipeable: Swipeable) => void;\n\n /**\n * Called when action panel is closed.\n */\n onSwipeableClose?: (\n direction: 'left' | 'right',\n swipeable: Swipeable\n ) => void;\n\n /**\n * @deprecated Use `direction` argument of onSwipeableWillOpen()\n *\n * Called when left action panel starts animating on open.\n */\n onSwipeableLeftWillOpen?: () => void;\n\n /**\n * @deprecated Use `direction` argument of onSwipeableWillOpen()\n *\n * Called when right action panel starts animating on open.\n */\n onSwipeableRightWillOpen?: () => void;\n\n /**\n * Called when action panel starts animating on open (either right or left).\n */\n onSwipeableWillOpen?: (direction: 'left' | 'right') => void;\n\n /**\n * Called when action panel starts animating on close.\n */\n onSwipeableWillClose?: (direction: 'left' | 'right') => void;\n\n /**\n *\n * This map describes the values to use as inputRange for extra interpolation:\n * AnimatedValue: [startValue, endValue]\n *\n * progressAnimatedValue: [0, 1] dragAnimatedValue: [0, +]\n *\n * To support `rtl` flexbox layouts use `flexDirection` styling.\n * */\n renderLeftActions?: (\n progressAnimatedValue: AnimatedInterpolation,\n dragAnimatedValue: AnimatedInterpolation\n ) => React.ReactNode;\n /**\n *\n * This map describes the values to use as inputRange for extra interpolation:\n * AnimatedValue: [startValue, endValue]\n *\n * progressAnimatedValue: [0, 1] dragAnimatedValue: [0, -]\n *\n * To support `rtl` flexbox layouts use `flexDirection` styling.\n * */\n renderRightActions?: (\n progressAnimatedValue: AnimatedInterpolation,\n dragAnimatedValue: AnimatedInterpolation,\n swipeable: Swipeable\n ) => React.ReactNode;\n\n useNativeAnimations?: boolean;\n\n animationOptions?: Record<string, unknown>;\n\n /**\n * Style object for the container (`Animated.View`), for example to override\n * `overflow: 'hidden'`.\n */\n containerStyle?: StyleProp<ViewStyle>;\n\n /**\n * Style object for the children container (`Animated.View`), for example to\n * apply `flex: 1`\n */\n childrenContainerStyle?: StyleProp<ViewStyle>;\n}\n\ntype SwipeableState = {\n dragX: Animated.Value;\n rowTranslation: Animated.Value;\n rowState: number;\n leftWidth?: number;\n rightOffset?: number;\n rowWidth?: number;\n};\n\nexport default class Swipeable extends Component<\n SwipeableProps,\n SwipeableState\n> {\n static defaultProps = {\n friction: 1,\n overshootFriction: 1,\n useNativeAnimations: true,\n };\n\n constructor(props: SwipeableProps) {\n super(props);\n const dragX = new Animated.Value(0);\n this.state = {\n dragX,\n rowTranslation: new Animated.Value(0),\n rowState: 0,\n leftWidth: undefined,\n rightOffset: undefined,\n rowWidth: undefined,\n };\n this.updateAnimatedEvent(props, this.state);\n\n this.onGestureEvent = Animated.event(\n [{ nativeEvent: { translationX: dragX } }],\n { useNativeDriver: props.useNativeAnimations! }\n );\n }\n\n shouldComponentUpdate(props: SwipeableProps, state: SwipeableState) {\n if (\n this.props.friction !== props.friction ||\n this.props.overshootLeft !== props.overshootLeft ||\n this.props.overshootRight !== props.overshootRight ||\n this.props.overshootFriction !== props.overshootFriction ||\n this.state.leftWidth !== state.leftWidth ||\n this.state.rightOffset !== state.rightOffset ||\n this.state.rowWidth !== state.rowWidth\n ) {\n this.updateAnimatedEvent(props, state);\n }\n\n return true;\n }\n\n private onGestureEvent?: (\n event: GestureEvent<PanGestureHandlerEventPayload>\n ) => void;\n private transX?: AnimatedInterpolation;\n private showLeftAction?: AnimatedInterpolation | Animated.Value;\n private leftActionTranslate?: AnimatedInterpolation;\n private showRightAction?: AnimatedInterpolation | Animated.Value;\n private rightActionTranslate?: AnimatedInterpolation;\n\n private updateAnimatedEvent = (\n props: SwipeableProps,\n state: SwipeableState\n ) => {\n const { friction, overshootFriction } = props;\n const { dragX, rowTranslation, leftWidth = 0, rowWidth = 0 } = state;\n const { rightOffset = rowWidth } = state;\n const rightWidth = Math.max(0, rowWidth - rightOffset);\n\n const { overshootLeft = leftWidth > 0, overshootRight = rightWidth > 0 } =\n props;\n\n const transX = Animated.add(\n rowTranslation,\n dragX.interpolate({\n inputRange: [0, friction!],\n outputRange: [0, 1],\n })\n ).interpolate({\n inputRange: [-rightWidth - 1, -rightWidth, leftWidth, leftWidth + 1],\n outputRange: [\n -rightWidth - (overshootRight ? 1 / overshootFriction! : 0),\n -rightWidth,\n leftWidth,\n leftWidth + (overshootLeft ? 1 / overshootFriction! : 0),\n ],\n });\n this.transX = transX;\n this.showLeftAction =\n leftWidth > 0\n ? transX.interpolate({\n inputRange: [-1, 0, leftWidth],\n outputRange: [0, 0, 1],\n })\n : new Animated.Value(0);\n this.leftActionTranslate = this.showLeftAction.interpolate({\n inputRange: [0, Number.MIN_VALUE],\n outputRange: [-10000, 0],\n extrapolate: 'clamp',\n });\n this.showRightAction =\n rightWidth > 0\n ? transX.interpolate({\n inputRange: [-rightWidth, 0, 1],\n outputRange: [1, 0, 0],\n })\n : new Animated.Value(0);\n this.rightActionTranslate = this.showRightAction.interpolate({\n inputRange: [0, Number.MIN_VALUE],\n outputRange: [-10000, 0],\n extrapolate: 'clamp',\n });\n };\n\n private onTapHandlerStateChange = ({\n nativeEvent,\n }: HandlerStateChangeEvent<TapGestureHandlerEventPayload>) => {\n if (nativeEvent.oldState === State.ACTIVE) {\n this.close();\n }\n };\n\n private onHandlerStateChange = (\n ev: HandlerStateChangeEvent<PanGestureHandlerEventPayload>\n ) => {\n if (ev.nativeEvent.oldState === State.ACTIVE) {\n this.handleRelease(ev);\n }\n };\n\n private handleRelease = (\n ev: HandlerStateChangeEvent<PanGestureHandlerEventPayload>\n ) => {\n const { velocityX, translationX: dragX } = ev.nativeEvent;\n const { leftWidth = 0, rowWidth = 0, rowState } = this.state;\n const { rightOffset = rowWidth } = this.state;\n const rightWidth = rowWidth - rightOffset;\n const {\n friction,\n leftThreshold = leftWidth / 2,\n rightThreshold = rightWidth / 2,\n } = this.props;\n\n const startOffsetX = this.currentOffset() + dragX / friction!;\n const translationX = (dragX + DRAG_TOSS * velocityX) / friction!;\n\n let toValue = 0;\n if (rowState === 0) {\n if (translationX > leftThreshold) {\n toValue = leftWidth;\n } else if (translationX < -rightThreshold) {\n toValue = -rightWidth;\n }\n } else if (rowState === 1) {\n // swiped to left\n if (translationX > -leftThreshold) {\n toValue = leftWidth;\n }\n } else {\n // swiped to right\n if (translationX < rightThreshold) {\n toValue = -rightWidth;\n }\n }\n\n this.animateRow(startOffsetX, toValue, velocityX / friction!);\n };\n\n private animateRow = (\n fromValue: number,\n toValue: number,\n velocityX?:\n | number\n | {\n x: number;\n y: number;\n }\n ) => {\n const { dragX, rowTranslation } = this.state;\n dragX.setValue(0);\n rowTranslation.setValue(fromValue);\n\n this.setState({ rowState: Math.sign(toValue) });\n Animated.spring(rowTranslation, {\n restSpeedThreshold: 1.7,\n restDisplacementThreshold: 0.4,\n velocity: velocityX,\n bounciness: 0,\n toValue,\n useNativeDriver: this.props.useNativeAnimations!,\n ...this.props.animationOptions,\n }).start(({ finished }) => {\n if (finished) {\n if (toValue > 0) {\n this.props.onSwipeableLeftOpen?.();\n this.props.onSwipeableOpen?.('left', this);\n } else if (toValue < 0) {\n this.props.onSwipeableRightOpen?.();\n this.props.onSwipeableOpen?.('right', this);\n } else {\n const closingDirection = fromValue > 0 ? 'left' : 'right';\n this.props.onSwipeableClose?.(closingDirection, this);\n }\n }\n });\n if (toValue > 0) {\n this.props.onSwipeableLeftWillOpen?.();\n this.props.onSwipeableWillOpen?.('left');\n } else if (toValue < 0) {\n this.props.onSwipeableRightWillOpen?.();\n this.props.onSwipeableWillOpen?.('right');\n } else {\n const closingDirection = fromValue > 0 ? 'left' : 'right';\n this.props.onSwipeableWillClose?.(closingDirection);\n }\n };\n\n private onRowLayout = ({ nativeEvent }: LayoutChangeEvent) => {\n this.setState({ rowWidth: nativeEvent.layout.width });\n };\n\n private currentOffset = () => {\n const { leftWidth = 0, rowWidth = 0, rowState } = this.state;\n const { rightOffset = rowWidth } = this.state;\n const rightWidth = rowWidth - rightOffset;\n if (rowState === 1) {\n return leftWidth;\n } else if (rowState === -1) {\n return -rightWidth;\n }\n return 0;\n };\n\n close = () => {\n this.animateRow(this.currentOffset(), 0);\n };\n\n openLeft = () => {\n const { leftWidth = 0 } = this.state;\n this.animateRow(this.currentOffset(), leftWidth);\n };\n\n openRight = () => {\n const { rowWidth = 0 } = this.state;\n const { rightOffset = rowWidth } = this.state;\n const rightWidth = rowWidth - rightOffset;\n this.animateRow(this.currentOffset(), -rightWidth);\n };\n\n render() {\n const { rowState } = this.state;\n const { children, renderLeftActions, renderRightActions } = this.props;\n\n const left = renderLeftActions && (\n <Animated.View\n style={[\n styles.leftActions,\n // all those and below parameters can have ! since they are all\n // asigned in constructor in `updateAnimatedEvent` but TS cannot spot\n // it for some reason\n { transform: [{ translateX: this.leftActionTranslate! }] },\n ]}>\n {renderLeftActions(this.showLeftAction!, this.transX!)}\n <View\n onLayout={({ nativeEvent }) =>\n this.setState({ leftWidth: nativeEvent.layout.x })\n }\n />\n </Animated.View>\n );\n\n const right = renderRightActions && (\n <Animated.View\n style={[\n styles.rightActions,\n { transform: [{ translateX: this.rightActionTranslate! }] },\n ]}>\n {renderRightActions(this.showRightAction!, this.transX!, this)}\n <View\n onLayout={({ nativeEvent }) =>\n this.setState({ rightOffset: nativeEvent.layout.x })\n }\n />\n </Animated.View>\n );\n\n return (\n <PanGestureHandler\n activeOffsetX={[-10, 10]}\n {...this.props}\n onGestureEvent={this.onGestureEvent}\n onHandlerStateChange={this.onHandlerStateChange}>\n <Animated.View\n onLayout={this.onRowLayout}\n style={[styles.container, this.props.containerStyle]}>\n {left}\n {right}\n <TapGestureHandler\n enabled={rowState !== 0}\n onHandlerStateChange={this.onTapHandlerStateChange}>\n <Animated.View\n pointerEvents={rowState === 0 ? 'auto' : 'box-only'}\n style={[\n {\n transform: [{ translateX: this.transX! }],\n },\n this.props.childrenContainerStyle,\n ]}>\n {children}\n </Animated.View>\n </TapGestureHandler>\n </Animated.View>\n </PanGestureHandler>\n );\n }\n}\n\nconst styles = StyleSheet.create({\n container: {\n overflow: 'hidden',\n },\n leftActions: {\n ...StyleSheet.absoluteFillObject,\n flexDirection: I18nManager.isRTL ? 'row-reverse' : 'row',\n },\n rightActions: {\n ...StyleSheet.absoluteFillObject,\n flexDirection: I18nManager.isRTL ? 'row' : 'row-reverse',\n },\n});\n"]},"metadata":{},"sourceType":"module","externalDependencies":[]}