{"ast":null,"code":"\"use strict\";\n\nimport _extends from \"@babel/runtime/helpers/extends\";\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\";\nvar _jsxFileName = \"/Users/rohitsingh/Documents/projects/new-nativebase-setup/NativeBase/example/node_modules/react-native-swipe-gestures/index.js\";\n\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); }; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nimport React, { Component } from \"react\";\nimport View from \"react-native-web/dist/exports/View\";\nimport PanResponder from \"react-native-web/dist/exports/PanResponder\";\nexport var swipeDirections = {\n  SWIPE_UP: \"SWIPE_UP\",\n  SWIPE_DOWN: \"SWIPE_DOWN\",\n  SWIPE_LEFT: \"SWIPE_LEFT\",\n  SWIPE_RIGHT: \"SWIPE_RIGHT\"\n};\nvar swipeConfig = {\n  velocityThreshold: 0.3,\n  directionalOffsetThreshold: 80,\n  gestureIsClickThreshold: 5\n};\n\nfunction isValidSwipe(velocity, velocityThreshold, directionalOffset, directionalOffsetThreshold) {\n  return Math.abs(velocity) > velocityThreshold && Math.abs(directionalOffset) < directionalOffsetThreshold;\n}\n\nvar GestureRecognizer = function (_Component) {\n  _inherits(GestureRecognizer, _Component);\n\n  var _super = _createSuper(GestureRecognizer);\n\n  function GestureRecognizer(props, context) {\n    var _this;\n\n    _classCallCheck(this, GestureRecognizer);\n\n    _this = _super.call(this, props, context);\n    _this.swipeConfig = _extends(swipeConfig, props.config);\n\n    var responderEnd = _this._handlePanResponderEnd.bind(_assertThisInitialized(_this));\n\n    var shouldSetResponder = _this._handleShouldSetPanResponder.bind(_assertThisInitialized(_this));\n\n    _this._panResponder = PanResponder.create({\n      onStartShouldSetPanResponder: shouldSetResponder,\n      onMoveShouldSetPanResponder: shouldSetResponder,\n      onPanResponderRelease: responderEnd,\n      onPanResponderTerminate: responderEnd\n    });\n    return _this;\n  }\n\n  _createClass(GestureRecognizer, [{\n    key: \"componentDidUpdate\",\n    value: function componentDidUpdate(prevProps) {\n      if (this.props.config !== prevProps.config) {\n        this.swipeConfig = _extends(swipeConfig, this.props.config);\n      }\n    }\n  }, {\n    key: \"_handleShouldSetPanResponder\",\n    value: function _handleShouldSetPanResponder(evt, gestureState) {\n      return evt.nativeEvent.touches.length === 1 && !this._gestureIsClick(gestureState);\n    }\n  }, {\n    key: \"_gestureIsClick\",\n    value: function _gestureIsClick(gestureState) {\n      return Math.abs(gestureState.dx) < swipeConfig.gestureIsClickThreshold && Math.abs(gestureState.dy) < swipeConfig.gestureIsClickThreshold;\n    }\n  }, {\n    key: \"_handlePanResponderEnd\",\n    value: function _handlePanResponderEnd(evt, gestureState) {\n      var swipeDirection = this._getSwipeDirection(gestureState);\n\n      this._triggerSwipeHandlers(swipeDirection, gestureState);\n    }\n  }, {\n    key: \"_triggerSwipeHandlers\",\n    value: function _triggerSwipeHandlers(swipeDirection, gestureState) {\n      var _this$props = this.props,\n          onSwipe = _this$props.onSwipe,\n          onSwipeUp = _this$props.onSwipeUp,\n          onSwipeDown = _this$props.onSwipeDown,\n          onSwipeLeft = _this$props.onSwipeLeft,\n          onSwipeRight = _this$props.onSwipeRight;\n      var SWIPE_LEFT = swipeDirections.SWIPE_LEFT,\n          SWIPE_RIGHT = swipeDirections.SWIPE_RIGHT,\n          SWIPE_UP = swipeDirections.SWIPE_UP,\n          SWIPE_DOWN = swipeDirections.SWIPE_DOWN;\n      onSwipe && onSwipe(swipeDirection, gestureState);\n\n      switch (swipeDirection) {\n        case SWIPE_LEFT:\n          onSwipeLeft && onSwipeLeft(gestureState);\n          break;\n\n        case SWIPE_RIGHT:\n          onSwipeRight && onSwipeRight(gestureState);\n          break;\n\n        case SWIPE_UP:\n          onSwipeUp && onSwipeUp(gestureState);\n          break;\n\n        case SWIPE_DOWN:\n          onSwipeDown && onSwipeDown(gestureState);\n          break;\n      }\n    }\n  }, {\n    key: \"_getSwipeDirection\",\n    value: function _getSwipeDirection(gestureState) {\n      var SWIPE_LEFT = swipeDirections.SWIPE_LEFT,\n          SWIPE_RIGHT = swipeDirections.SWIPE_RIGHT,\n          SWIPE_UP = swipeDirections.SWIPE_UP,\n          SWIPE_DOWN = swipeDirections.SWIPE_DOWN;\n      var dx = gestureState.dx,\n          dy = gestureState.dy;\n\n      if (this._isValidHorizontalSwipe(gestureState)) {\n        return dx > 0 ? SWIPE_RIGHT : SWIPE_LEFT;\n      } else if (this._isValidVerticalSwipe(gestureState)) {\n        return dy > 0 ? SWIPE_DOWN : SWIPE_UP;\n      }\n\n      return null;\n    }\n  }, {\n    key: \"_isValidHorizontalSwipe\",\n    value: function _isValidHorizontalSwipe(gestureState) {\n      var vx = gestureState.vx,\n          dy = gestureState.dy;\n      var _this$swipeConfig = this.swipeConfig,\n          velocityThreshold = _this$swipeConfig.velocityThreshold,\n          directionalOffsetThreshold = _this$swipeConfig.directionalOffsetThreshold;\n      return isValidSwipe(vx, velocityThreshold, dy, directionalOffsetThreshold);\n    }\n  }, {\n    key: \"_isValidVerticalSwipe\",\n    value: function _isValidVerticalSwipe(gestureState) {\n      var vy = gestureState.vy,\n          dx = gestureState.dx;\n      var _this$swipeConfig2 = this.swipeConfig,\n          velocityThreshold = _this$swipeConfig2.velocityThreshold,\n          directionalOffsetThreshold = _this$swipeConfig2.directionalOffsetThreshold;\n      return isValidSwipe(vy, velocityThreshold, dx, directionalOffsetThreshold);\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      return React.createElement(View, _extends({}, this.props, this._panResponder.panHandlers));\n    }\n  }]);\n\n  return GestureRecognizer;\n}(Component);\n\nexport default GestureRecognizer;","map":{"version":3,"sources":["/Users/rohitsingh/Documents/projects/new-nativebase-setup/NativeBase/example/node_modules/react-native-swipe-gestures/index.js"],"names":["React","Component","swipeDirections","SWIPE_UP","SWIPE_DOWN","SWIPE_LEFT","SWIPE_RIGHT","swipeConfig","velocityThreshold","directionalOffsetThreshold","gestureIsClickThreshold","isValidSwipe","velocity","directionalOffset","Math","abs","GestureRecognizer","props","context","config","responderEnd","_handlePanResponderEnd","bind","shouldSetResponder","_handleShouldSetPanResponder","_panResponder","PanResponder","create","onStartShouldSetPanResponder","onMoveShouldSetPanResponder","onPanResponderRelease","onPanResponderTerminate","prevProps","evt","gestureState","nativeEvent","touches","length","_gestureIsClick","dx","dy","swipeDirection","_getSwipeDirection","_triggerSwipeHandlers","onSwipe","onSwipeUp","onSwipeDown","onSwipeLeft","onSwipeRight","_isValidHorizontalSwipe","_isValidVerticalSwipe","vx","vy","panHandlers"],"mappings":"AAAA;;;;;;;;;;;;;;;AAEA,OAAOA,KAAP,IAAgBC,SAAhB,QAAiC,OAAjC;;;AAGA,OAAO,IAAMC,eAAe,GAAG;AAC7BC,EAAAA,QAAQ,EAAE,UADmB;AAE7BC,EAAAA,UAAU,EAAE,YAFiB;AAG7BC,EAAAA,UAAU,EAAE,YAHiB;AAI7BC,EAAAA,WAAW,EAAE;AAJgB,CAAxB;AAOP,IAAMC,WAAW,GAAG;AAClBC,EAAAA,iBAAiB,EAAE,GADD;AAElBC,EAAAA,0BAA0B,EAAE,EAFV;AAGlBC,EAAAA,uBAAuB,EAAE;AAHP,CAApB;;AAMA,SAASC,YAAT,CACEC,QADF,EAEEJ,iBAFF,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BmC,EAFuB,GAEZL,YAFY,CAEvBK,EAFuB;AAAA,UAEnBC,EAFmB,GAEZN,YAFY,CAEnBM,EAFmB;;AAG/B,UAAI,KAAKS,uBAAL,CAA6Bf,YAA7B,CAAJ,EAAgD;AAC9C,eAAOK,EAAE,GAAG,CAAL,GAASjC,WAAT,GAAuBD,UAA9B;AACD,OAFD,MAEO,IAAI,KAAK6C,qBAAL,CAA2BhB,YAA3B,CAAJ,EAA8C;AACnD,eAAOM,EAAE,GAAG,CAAL,GAASpC,UAAT,GAAsBD,QAA7B;AACD;;AACD,aAAO,IAAP;AACD;;;4CAEuB+B,Y,EAAc;AAAA,UAC5BiB,EAD4B,GACjBjB,YADiB,CAC5BiB,EAD4B;AAAA,UACxBX,EADwB,GACjBN,YADiB,CACxBM,EADwB;AAAA,8BAEsB,KAAKjC,WAF3B;AAAA,UAE5BC,iBAF4B,qBAE5BA,iBAF4B;AAAA,UAETC,0BAFS,qBAETA,0BAFS;AAGpC,aAAOE,YAAY,CAACwC,EAAD,EAAK3C,iBAAL,EAAwBgC,EAAxB,EAA4B/B,0BAA5B,CAAnB;AACD;;;0CAEqByB,Y,EAAc;AAAA,UAC1BkB,EAD0B,GACflB,YADe,CAC1BkB,EAD0B;AAAA,UACtBb,EADsB,GACfL,YADe,CACtBK,EADsB;AAAA,+BAEwB,KAAKhC,WAF7B;AAAA,UAE1BC,iBAF0B,sBAE1BA,iBAF0B;AAAA,UAEPC,0BAFO,sBAEPA,0BAFO;AAGlC,aAAOE,YAAY,CAACyC,EAAD,EAAK5C,iBAAL,EAAwB+B,EAAxB,EAA4B9B,0BAA5B,CAAnB;AACD;;;6BAEQ;AACP,aAAO,oBAAC,IAAD,eAAU,KAAKQ,KAAf,EAA0B,KAAKQ,aAAL,CAAmB4B,WAA7C,EAAP;AACD;;;;EA3F6BpD,S;;AA8FhC,eAAee,iBAAf","sourcesContent":["\"use strict\";\n\nimport React, { Component } from \"react\";\nimport { View, PanResponder } from \"react-native\";\n\nexport const swipeDirections = {\n  SWIPE_UP: \"SWIPE_UP\",\n  SWIPE_DOWN: \"SWIPE_DOWN\",\n  SWIPE_LEFT: \"SWIPE_LEFT\",\n  SWIPE_RIGHT: \"SWIPE_RIGHT\"\n};\n\nconst swipeConfig = {\n  velocityThreshold: 0.3,\n  directionalOffsetThreshold: 80,\n  gestureIsClickThreshold: 5\n};\n\nfunction isValidSwipe(\n  velocity,\n  velocityThreshold,\n  directionalOffset,\n  directionalOffsetThreshold\n) {\n  return (\n    Math.abs(velocity) > velocityThreshold &&\n    Math.abs(directionalOffset) < directionalOffsetThreshold\n  );\n}\n\nclass GestureRecognizer extends Component {\n  constructor(props, context) {\n    super(props, context);\n    this.swipeConfig = Object.assign(swipeConfig, props.config);\n\n    const responderEnd = this._handlePanResponderEnd.bind(this);\n    const shouldSetResponder = this._handleShouldSetPanResponder.bind(this);\n    this._panResponder = PanResponder.create({\n      onStartShouldSetPanResponder: shouldSetResponder,\n      onMoveShouldSetPanResponder: shouldSetResponder,\n      onPanResponderRelease: responderEnd,\n      onPanResponderTerminate: responderEnd\n    });\n  }\n  \n  componentDidUpdate(prevProps) {\n    if (this.props.config !== prevProps.config) {\n      this.swipeConfig = Object.assign(swipeConfig, this.props.config);\n    }\n  }\n  \n  _handleShouldSetPanResponder(evt, gestureState) {\n    return (\n      evt.nativeEvent.touches.length === 1 &&\n      !this._gestureIsClick(gestureState)\n    );\n  }\n\n  _gestureIsClick(gestureState) {\n    return (\n      Math.abs(gestureState.dx) < swipeConfig.gestureIsClickThreshold &&\n      Math.abs(gestureState.dy) < swipeConfig.gestureIsClickThreshold\n    );\n  }\n\n  _handlePanResponderEnd(evt, gestureState) {\n    const swipeDirection = this._getSwipeDirection(gestureState);\n    this._triggerSwipeHandlers(swipeDirection, gestureState);\n  }\n\n  _triggerSwipeHandlers(swipeDirection, gestureState) {\n    const {\n      onSwipe,\n      onSwipeUp,\n      onSwipeDown,\n      onSwipeLeft,\n      onSwipeRight\n    } = this.props;\n    const { SWIPE_LEFT, SWIPE_RIGHT, SWIPE_UP, SWIPE_DOWN } = swipeDirections;\n    onSwipe && onSwipe(swipeDirection, gestureState);\n    switch (swipeDirection) {\n      case SWIPE_LEFT:\n        onSwipeLeft && onSwipeLeft(gestureState);\n        break;\n      case SWIPE_RIGHT:\n        onSwipeRight && onSwipeRight(gestureState);\n        break;\n      case SWIPE_UP:\n        onSwipeUp && onSwipeUp(gestureState);\n        break;\n      case SWIPE_DOWN:\n        onSwipeDown && onSwipeDown(gestureState);\n        break;\n    }\n  }\n\n  _getSwipeDirection(gestureState) {\n    const { SWIPE_LEFT, SWIPE_RIGHT, SWIPE_UP, SWIPE_DOWN } = swipeDirections;\n    const { dx, dy } = gestureState;\n    if (this._isValidHorizontalSwipe(gestureState)) {\n      return dx > 0 ? SWIPE_RIGHT : SWIPE_LEFT;\n    } else if (this._isValidVerticalSwipe(gestureState)) {\n      return dy > 0 ? SWIPE_DOWN : SWIPE_UP;\n    }\n    return null;\n  }\n\n  _isValidHorizontalSwipe(gestureState) {\n    const { vx, dy } = gestureState;\n    const { velocityThreshold, directionalOffsetThreshold } = this.swipeConfig;\n    return isValidSwipe(vx, velocityThreshold, dy, directionalOffsetThreshold);\n  }\n\n  _isValidVerticalSwipe(gestureState) {\n    const { vy, dx } = gestureState;\n    const { velocityThreshold, directionalOffsetThreshold } = this.swipeConfig;\n    return isValidSwipe(vy, velocityThreshold, dx, directionalOffsetThreshold);\n  }\n\n  render() {\n    return <View {...this.props} {...this._panResponder.panHandlers} />;\n  }\n}\n\nexport default GestureRecognizer;\n"]},"metadata":{},"sourceType":"module"}