{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/extends\";\nimport _objectWithoutProperties from \"@babel/runtime/helpers/objectWithoutProperties\";\nimport _defineProperty from \"@babel/runtime/helpers/defineProperty\";\nimport _classCallCheck from \"@babel/runtime/helpers/classCallCheck\";\nimport _createClass from \"@babel/runtime/helpers/createClass\";\nimport _inherits from \"@babel/runtime/helpers/inherits\";\nimport _possibleConstructorReturn from \"@babel/runtime/helpers/possibleConstructorReturn\";\nimport _getPrototypeOf from \"@babel/runtime/helpers/getPrototypeOf\";\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\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 * as React from 'react';\nimport Animated from \"react-native-web/dist/exports/Animated\";\nimport DeviceEventEmitter from \"react-native-web/dist/exports/DeviceEventEmitter\";\nimport Dimensions from \"react-native-web/dist/exports/Dimensions\";\nimport KeyboardAvoidingView from \"react-native-web/dist/exports/KeyboardAvoidingView\";\nimport Modal from \"react-native-web/dist/exports/Modal\";\nimport PanResponder from \"react-native-web/dist/exports/PanResponder\";\nimport Platform from \"react-native-web/dist/exports/Platform\";\nimport TouchableWithoutFeedback from \"react-native-web/dist/exports/TouchableWithoutFeedback\";\nimport View from \"react-native-web/dist/exports/View\";\nimport * as PropTypes from 'prop-types';\nimport * as animatable from 'react-native-animatable';\nimport { initializeAnimations, buildAnimations, reversePercentage } from \"./utils\";\nimport styles from \"./modal.style\";\ninitializeAnimations();\n\nvar extractAnimationFromProps = function extractAnimationFromProps(props) {\n  return {\n    animationIn: props.animationIn,\n    animationOut: props.animationOut\n  };\n};\n\nexport var ReactNativeModal = function (_React$Component) {\n  _inherits(ReactNativeModal, _React$Component);\n\n  var _super = _createSuper(ReactNativeModal);\n\n  function ReactNativeModal(props) {\n    var _this;\n\n    _classCallCheck(this, ReactNativeModal);\n\n    _this = _super.call(this, props);\n    _this.state = {\n      showContent: true,\n      isVisible: false,\n      deviceWidth: Dimensions.get('screen').width,\n      deviceHeight: Dimensions.get('screen').height,\n      isSwipeable: _this.props.swipeDirection ? true : false,\n      pan: null\n    };\n    _this.isTransitioning = false;\n    _this.inSwipeClosingState = false;\n    _this.currentSwipingDirection = null;\n    _this.panResponder = null;\n\n    _this.buildPanResponder = function () {\n      var animEvt = null;\n      _this.panResponder = PanResponder.create({\n        onMoveShouldSetPanResponder: function onMoveShouldSetPanResponder(evt, gestureState) {\n          if (!_this.props.propagateSwipe) {\n            var shouldSetPanResponder = Math.abs(gestureState.dx) >= 4 || Math.abs(gestureState.dy) >= 4;\n\n            if (shouldSetPanResponder && _this.props.onSwipeStart) {\n              _this.props.onSwipeStart();\n            }\n\n            _this.currentSwipingDirection = _this.getSwipingDirection(gestureState);\n            animEvt = _this.createAnimationEventForSwipe();\n            return shouldSetPanResponder;\n          }\n\n          return false;\n        },\n        onStartShouldSetPanResponder: function onStartShouldSetPanResponder(e) {\n          var hasScrollableView = e._dispatchInstances && e._dispatchInstances.some(function (instance) {\n            return /scrollview|flatlist/i.test(instance.type);\n          });\n\n          if (hasScrollableView && _this.props.propagateSwipe && _this.props.scrollTo && _this.props.scrollOffset > 0) {\n            return false;\n          }\n\n          if (_this.props.onSwipeStart) {\n            _this.props.onSwipeStart();\n          }\n\n          _this.currentSwipingDirection = null;\n          return true;\n        },\n        onPanResponderMove: function onPanResponderMove(evt, gestureState) {\n          if (!_this.currentSwipingDirection) {\n            if (gestureState.dx === 0 && gestureState.dy === 0) {\n              return;\n            }\n\n            _this.currentSwipingDirection = _this.getSwipingDirection(gestureState);\n            animEvt = _this.createAnimationEventForSwipe();\n          }\n\n          if (_this.isSwipeDirectionAllowed(gestureState)) {\n            var newOpacityFactor = 1 - _this.calcDistancePercentage(gestureState);\n\n            _this.backdropRef && _this.backdropRef.transitionTo({\n              opacity: _this.props.backdropOpacity * newOpacityFactor\n            });\n            animEvt(evt, gestureState);\n\n            if (_this.props.onSwipeMove) {\n              _this.props.onSwipeMove(newOpacityFactor);\n            }\n          } else {\n            if (_this.props.scrollTo) {\n              if (_this.props.scrollHorizontal) {\n                var offsetX = -gestureState.dx;\n\n                if (offsetX > _this.props.scrollOffsetMax) {\n                  offsetX -= (offsetX - _this.props.scrollOffsetMax) / 2;\n                }\n\n                _this.props.scrollTo({\n                  x: offsetX,\n                  animated: false\n                });\n              } else {\n                var offsetY = -gestureState.dy;\n\n                if (offsetY > _this.props.scrollOffsetMax) {\n                  offsetY -= (offsetY - _this.props.scrollOffsetMax) / 2;\n                }\n\n                _this.props.scrollTo({\n                  y: offsetY,\n                  animated: false\n                });\n              }\n            }\n          }\n        },\n        onPanResponderRelease: function onPanResponderRelease(evt, gestureState) {\n          var accDistance = _this.getAccDistancePerDirection(gestureState);\n\n          if (accDistance > _this.props.swipeThreshold && _this.isSwipeDirectionAllowed(gestureState)) {\n            if (_this.props.onSwipeComplete) {\n              _this.inSwipeClosingState = true;\n\n              _this.props.onSwipeComplete({\n                swipingDirection: _this.getSwipingDirection(gestureState)\n              });\n\n              return;\n            }\n\n            if (_this.props.onSwipe) {\n              _this.inSwipeClosingState = true;\n\n              _this.props.onSwipe();\n\n              return;\n            }\n          }\n\n          if (_this.props.onSwipeCancel) {\n            _this.props.onSwipeCancel();\n          }\n\n          if (_this.backdropRef) {\n            _this.backdropRef.transitionTo({\n              opacity: _this.props.backdropOpacity\n            });\n          }\n\n          Animated.spring(_this.state.pan, {\n            toValue: {\n              x: 0,\n              y: 0\n            },\n            bounciness: 0,\n            useNativeDriver: false\n          }).start();\n\n          if (_this.props.scrollTo) {\n            if (_this.props.scrollOffset > _this.props.scrollOffsetMax) {\n              _this.props.scrollTo({\n                y: _this.props.scrollOffsetMax,\n                animated: true\n              });\n            }\n          }\n        }\n      });\n    };\n\n    _this.getAccDistancePerDirection = function (gestureState) {\n      switch (_this.currentSwipingDirection) {\n        case 'up':\n          return -gestureState.dy;\n\n        case 'down':\n          return gestureState.dy;\n\n        case 'right':\n          return gestureState.dx;\n\n        case 'left':\n          return -gestureState.dx;\n\n        default:\n          return 0;\n      }\n    };\n\n    _this.getSwipingDirection = function (gestureState) {\n      if (Math.abs(gestureState.dx) > Math.abs(gestureState.dy)) {\n        return gestureState.dx > 0 ? 'right' : 'left';\n      }\n\n      return gestureState.dy > 0 ? 'down' : 'up';\n    };\n\n    _this.calcDistancePercentage = function (gestureState) {\n      switch (_this.currentSwipingDirection) {\n        case 'down':\n          return (gestureState.moveY - gestureState.y0) / ((_this.props.deviceHeight || _this.state.deviceHeight) - gestureState.y0);\n\n        case 'up':\n          return reversePercentage(gestureState.moveY / gestureState.y0);\n\n        case 'left':\n          return reversePercentage(gestureState.moveX / gestureState.x0);\n\n        case 'right':\n          return (gestureState.moveX - gestureState.x0) / ((_this.props.deviceWidth || _this.state.deviceWidth) - gestureState.x0);\n\n        default:\n          return 0;\n      }\n    };\n\n    _this.createAnimationEventForSwipe = function () {\n      if (_this.currentSwipingDirection === 'right' || _this.currentSwipingDirection === 'left') {\n        return Animated.event([null, {\n          dx: _this.state.pan.x\n        }], {\n          useNativeDriver: false\n        });\n      } else {\n        return Animated.event([null, {\n          dy: _this.state.pan.y\n        }], {\n          useNativeDriver: false\n        });\n      }\n    };\n\n    _this.isDirectionIncluded = function (direction) {\n      return Array.isArray(_this.props.swipeDirection) ? _this.props.swipeDirection.includes(direction) : _this.props.swipeDirection === direction;\n    };\n\n    _this.isSwipeDirectionAllowed = function (_ref) {\n      var dy = _ref.dy,\n          dx = _ref.dx;\n      var draggedDown = dy > 0;\n      var draggedUp = dy < 0;\n      var draggedLeft = dx < 0;\n      var draggedRight = dx > 0;\n\n      if (_this.currentSwipingDirection === 'up' && _this.isDirectionIncluded('up') && draggedUp) {\n        return true;\n      } else if (_this.currentSwipingDirection === 'down' && _this.isDirectionIncluded('down') && draggedDown) {\n        return true;\n      } else if (_this.currentSwipingDirection === 'right' && _this.isDirectionIncluded('right') && draggedRight) {\n        return true;\n      } else if (_this.currentSwipingDirection === 'left' && _this.isDirectionIncluded('left') && draggedLeft) {\n        return true;\n      }\n\n      return false;\n    };\n\n    _this.handleDimensionsUpdate = function () {\n      if (!_this.props.deviceHeight && !_this.props.deviceWidth) {\n        var deviceWidth = Dimensions.get('screen').width;\n        var deviceHeight = Dimensions.get('screen').height;\n\n        if (deviceWidth !== _this.state.deviceWidth || deviceHeight !== _this.state.deviceHeight) {\n          _this.setState({\n            deviceWidth: deviceWidth,\n            deviceHeight: deviceHeight\n          });\n        }\n      }\n    };\n\n    _this.open = function () {\n      if (_this.isTransitioning) {\n        return;\n      }\n\n      _this.isTransitioning = true;\n\n      if (_this.backdropRef) {\n        _this.backdropRef.transitionTo({\n          opacity: _this.props.backdropOpacity\n        }, _this.props.backdropTransitionInTiming);\n      }\n\n      if (_this.state.isSwipeable) {\n        _this.state.pan.setValue({\n          x: 0,\n          y: 0\n        });\n      }\n\n      if (_this.contentRef) {\n        _this.props.onModalWillShow && _this.props.onModalWillShow();\n\n        _this.contentRef.animate(_this.animationIn, _this.props.animationInTiming).then(function () {\n          _this.isTransitioning = false;\n\n          if (!_this.props.isVisible) {\n            _this.close();\n          } else {\n            _this.props.onModalShow();\n          }\n        });\n      }\n    };\n\n    _this.close = function () {\n      if (_this.isTransitioning) {\n        return;\n      }\n\n      _this.isTransitioning = true;\n\n      if (_this.backdropRef) {\n        _this.backdropRef.transitionTo({\n          opacity: 0\n        }, _this.props.backdropTransitionOutTiming);\n      }\n\n      var animationOut = _this.animationOut;\n\n      if (_this.inSwipeClosingState) {\n        _this.inSwipeClosingState = false;\n\n        if (_this.currentSwipingDirection === 'up') {\n          animationOut = 'slideOutUp';\n        } else if (_this.currentSwipingDirection === 'down') {\n          animationOut = 'slideOutDown';\n        } else if (_this.currentSwipingDirection === 'right') {\n          animationOut = 'slideOutRight';\n        } else if (_this.currentSwipingDirection === 'left') {\n          animationOut = 'slideOutLeft';\n        }\n      }\n\n      if (_this.contentRef) {\n        _this.props.onModalWillHide && _this.props.onModalWillHide();\n\n        _this.contentRef.animate(animationOut, _this.props.animationOutTiming).then(function () {\n          _this.isTransitioning = false;\n\n          if (_this.props.isVisible) {\n            _this.open();\n          } else {\n            _this.setState({\n              showContent: false\n            }, function () {\n              _this.setState({\n                isVisible: false\n              }, function () {\n                _this.props.onModalHide();\n              });\n            });\n          }\n        });\n      }\n    };\n\n    var _buildAnimations = buildAnimations(extractAnimationFromProps(props)),\n        animationIn = _buildAnimations.animationIn,\n        animationOut = _buildAnimations.animationOut;\n\n    _this.animationIn = animationIn;\n    _this.animationOut = animationOut;\n\n    if (_this.state.isSwipeable) {\n      _this.state = _objectSpread(_objectSpread({}, _this.state), {}, {\n        pan: new Animated.ValueXY()\n      });\n\n      _this.buildPanResponder();\n    }\n\n    if (props.isVisible) {\n      _this.state = _objectSpread(_objectSpread({}, _this.state), {}, {\n        isVisible: true,\n        showContent: true\n      });\n    }\n\n    return _this;\n  }\n\n  _createClass(ReactNativeModal, [{\n    key: \"componentDidMount\",\n    value: function componentDidMount() {\n      if (this.props.onSwipe) {\n        console.warn('`<Modal onSwipe=\"...\" />` is deprecated and will be removed starting from 13.0.0. Use `<Modal onSwipeComplete=\"...\" />` instead.');\n      }\n\n      DeviceEventEmitter.addListener('didUpdateDimensions', this.handleDimensionsUpdate);\n\n      if (this.state.isVisible) {\n        this.open();\n      }\n    }\n  }, {\n    key: \"componentWillUnmount\",\n    value: function componentWillUnmount() {\n      DeviceEventEmitter.removeListener('didUpdateDimensions', this.handleDimensionsUpdate);\n    }\n  }, {\n    key: \"componentDidUpdate\",\n    value: function componentDidUpdate(prevProps) {\n      if (this.props.animationIn !== prevProps.animationIn || this.props.animationOut !== prevProps.animationOut) {\n        var _buildAnimations2 = buildAnimations(extractAnimationFromProps(this.props)),\n            animationIn = _buildAnimations2.animationIn,\n            animationOut = _buildAnimations2.animationOut;\n\n        this.animationIn = animationIn;\n        this.animationOut = animationOut;\n      }\n\n      if (this.props.backdropOpacity !== prevProps.backdropOpacity && this.backdropRef) {\n        this.backdropRef.transitionTo({\n          opacity: this.props.backdropOpacity\n        }, this.props.backdropTransitionInTiming);\n      }\n\n      if (this.props.isVisible && !prevProps.isVisible) {\n        this.open();\n      } else if (!this.props.isVisible && prevProps.isVisible) {\n        this.close();\n      }\n    }\n  }, {\n    key: \"render\",\n    value: function render() {\n      var _this2 = this;\n\n      var _this$props = this.props,\n          animationIn = _this$props.animationIn,\n          animationInTiming = _this$props.animationInTiming,\n          animationOut = _this$props.animationOut,\n          animationOutTiming = _this$props.animationOutTiming,\n          avoidKeyboard = _this$props.avoidKeyboard,\n          coverScreen = _this$props.coverScreen,\n          hasBackdrop = _this$props.hasBackdrop,\n          backdropColor = _this$props.backdropColor,\n          backdropOpacity = _this$props.backdropOpacity,\n          backdropTransitionInTiming = _this$props.backdropTransitionInTiming,\n          backdropTransitionOutTiming = _this$props.backdropTransitionOutTiming,\n          customBackdrop = _this$props.customBackdrop,\n          children = _this$props.children,\n          deviceHeightProp = _this$props.deviceHeight,\n          deviceWidthProp = _this$props.deviceWidth,\n          isVisible = _this$props.isVisible,\n          onModalShow = _this$props.onModalShow,\n          onBackdropPress = _this$props.onBackdropPress,\n          onBackButtonPress = _this$props.onBackButtonPress,\n          useNativeDriver = _this$props.useNativeDriver,\n          propagateSwipe = _this$props.propagateSwipe,\n          style = _this$props.style,\n          otherProps = _objectWithoutProperties(_this$props, [\"animationIn\", \"animationInTiming\", \"animationOut\", \"animationOutTiming\", \"avoidKeyboard\", \"coverScreen\", \"hasBackdrop\", \"backdropColor\", \"backdropOpacity\", \"backdropTransitionInTiming\", \"backdropTransitionOutTiming\", \"customBackdrop\", \"children\", \"deviceHeight\", \"deviceWidth\", \"isVisible\", \"onModalShow\", \"onBackdropPress\", \"onBackButtonPress\", \"useNativeDriver\", \"propagateSwipe\", \"style\"]);\n\n      var deviceWidth = deviceWidthProp || this.state.deviceWidth;\n      var deviceHeight = deviceHeightProp || this.state.deviceHeight;\n      var computedStyle = [{\n        margin: deviceWidth * 0.05,\n        transform: [{\n          translateY: 0\n        }]\n      }, styles.content, style];\n      var panHandlers = {};\n      var panPosition = {};\n\n      if (this.state.isSwipeable) {\n        panHandlers = _objectSpread({}, this.panResponder.panHandlers);\n\n        if (useNativeDriver) {\n          panPosition = {\n            transform: this.state.pan.getTranslateTransform()\n          };\n        } else {\n          panPosition = this.state.pan.getLayout();\n        }\n      }\n\n      var _children = this.props.hideModalContentWhileAnimating && this.props.useNativeDriver && !this.state.showContent ? React.createElement(animatable.View, null) : children;\n\n      var containerView = React.createElement(animatable.View, _extends({}, panHandlers, {\n        ref: function ref(_ref2) {\n          return _this2.contentRef = _ref2;\n        },\n        style: [panPosition, computedStyle],\n        pointerEvents: \"box-none\",\n        useNativeDriver: useNativeDriver\n      }, otherProps), _children);\n      var hasCustomBackdrop = React.isValidElement(customBackdrop);\n      var backdropComputedStyle = [{\n        width: deviceWidth,\n        height: deviceHeight,\n        backgroundColor: this.state.showContent && !hasCustomBackdrop ? backdropColor : 'transparent'\n      }];\n      var backdropContent = React.createElement(animatable.View, {\n        ref: function ref(_ref3) {\n          return _this2.backdropRef = _ref3;\n        },\n        useNativeDriver: useNativeDriver,\n        style: [styles.backdrop, backdropComputedStyle]\n      }, hasCustomBackdrop && customBackdrop);\n      var backdrop = null;\n\n      if (hasCustomBackdrop) {\n        backdrop = backdropContent;\n      } else {\n        backdrop = React.createElement(TouchableWithoutFeedback, {\n          onPress: onBackdropPress\n        }, backdropContent);\n      }\n\n      if (!coverScreen && this.state.isVisible) {\n        return React.createElement(View, {\n          pointerEvents: \"box-none\",\n          style: [styles.backdrop, styles.containerBox]\n        }, hasBackdrop && backdrop, containerView);\n      }\n\n      return React.createElement(Modal, _extends({\n        transparent: true,\n        animationType: 'none',\n        visible: this.state.isVisible,\n        onRequestClose: onBackButtonPress\n      }, otherProps), hasBackdrop && backdrop, avoidKeyboard && React.createElement(KeyboardAvoidingView, {\n        behavior: Platform.OS === 'ios' ? 'padding' : undefined,\n        pointerEvents: \"box-none\",\n        style: computedStyle.concat([{\n          margin: 0\n        }])\n      }, containerView), !avoidKeyboard && containerView);\n    }\n  }], [{\n    key: \"getDerivedStateFromProps\",\n    value: function getDerivedStateFromProps(nextProps, state) {\n      if (!state.isVisible && nextProps.isVisible) {\n        return {\n          isVisible: true,\n          showContent: true\n        };\n      }\n\n      return null;\n    }\n  }]);\n\n  return ReactNativeModal;\n}(React.Component);\nReactNativeModal.propTypes = {\n  animationIn: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n  animationInTiming: PropTypes.number,\n  animationOut: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n  animationOutTiming: PropTypes.number,\n  avoidKeyboard: PropTypes.bool,\n  coverScreen: PropTypes.bool,\n  hasBackdrop: PropTypes.bool,\n  backdropColor: PropTypes.string,\n  backdropOpacity: PropTypes.number,\n  backdropTransitionInTiming: PropTypes.number,\n  backdropTransitionOutTiming: PropTypes.number,\n  customBackdrop: PropTypes.node,\n  children: PropTypes.node.isRequired,\n  deviceHeight: PropTypes.number,\n  deviceWidth: PropTypes.number,\n  isVisible: PropTypes.bool.isRequired,\n  hideModalContentWhileAnimating: PropTypes.bool,\n  propagateSwipe: PropTypes.bool,\n  onModalShow: PropTypes.func,\n  onModalWillShow: PropTypes.func,\n  onModalHide: PropTypes.func,\n  onModalWillHide: PropTypes.func,\n  onBackButtonPress: PropTypes.func,\n  onBackdropPress: PropTypes.func,\n  onSwipeStart: PropTypes.func,\n  onSwipeMove: PropTypes.func,\n  onSwipeComplete: PropTypes.func,\n  onSwipeCancel: PropTypes.func,\n  swipeThreshold: PropTypes.number,\n  swipeDirection: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOf(['up', 'down', 'left', 'right'])), PropTypes.oneOf(['up', 'down', 'left', 'right'])]),\n  useNativeDriver: PropTypes.bool,\n  style: PropTypes.any,\n  scrollTo: PropTypes.func,\n  scrollOffset: PropTypes.number,\n  scrollOffsetMax: PropTypes.number,\n  scrollHorizontal: PropTypes.bool,\n  supportedOrientations: PropTypes.arrayOf(PropTypes.oneOf(['portrait', 'portrait-upside-down', 'landscape', 'landscape-left', 'landscape-right']))\n};\nReactNativeModal.defaultProps = {\n  animationIn: 'slideInUp',\n  animationInTiming: 300,\n  animationOut: 'slideOutDown',\n  animationOutTiming: 300,\n  avoidKeyboard: false,\n  coverScreen: true,\n  hasBackdrop: true,\n  backdropColor: 'black',\n  backdropOpacity: 0.7,\n  backdropTransitionInTiming: 300,\n  backdropTransitionOutTiming: 300,\n  customBackdrop: null,\n  useNativeDriver: false,\n  deviceHeight: null,\n  deviceWidth: null,\n  hideModalContentWhileAnimating: false,\n  propagateSwipe: false,\n  isVisible: false,\n  onModalShow: function onModalShow() {\n    return null;\n  },\n  onModalWillShow: function onModalWillShow() {\n    return null;\n  },\n  onModalHide: function onModalHide() {\n    return null;\n  },\n  onModalWillHide: function onModalWillHide() {\n    return null;\n  },\n  onBackdropPress: function onBackdropPress() {\n    return null;\n  },\n  onBackButtonPress: function onBackButtonPress() {\n    return null;\n  },\n  swipeThreshold: 100,\n  scrollTo: null,\n  scrollOffset: 0,\n  scrollOffsetMax: 0,\n  scrollHorizontal: false,\n  supportedOrientations: ['portrait', 'landscape']\n};\nexport default ReactNativeModal;","map":{"version":3,"sources":["/Users/rohitsingh/Documents/projects/new-nativebase-setup/NativeBase/example/node_modules/react-native-modal/dist/modal.js"],"names":["React","PropTypes","animatable","initializeAnimations","buildAnimations","reversePercentage","styles","extractAnimationFromProps","props","animationIn","animationOut","ReactNativeModal","state","showContent","isVisible","deviceWidth","Dimensions","get","width","deviceHeight","height","isSwipeable","swipeDirection","pan","isTransitioning","inSwipeClosingState","currentSwipingDirection","panResponder","buildPanResponder","animEvt","PanResponder","create","onMoveShouldSetPanResponder","evt","gestureState","propagateSwipe","shouldSetPanResponder","Math","abs","dx","dy","onSwipeStart","getSwipingDirection","createAnimationEventForSwipe","onStartShouldSetPanResponder","e","hasScrollableView","_dispatchInstances","some","instance","test","type","scrollTo","scrollOffset","onPanResponderMove","isSwipeDirectionAllowed","newOpacityFactor","calcDistancePercentage","backdropRef","transitionTo","opacity","backdropOpacity","onSwipeMove","scrollHorizontal","offsetX","scrollOffsetMax","x","animated","offsetY","y","onPanResponderRelease","accDistance","getAccDistancePerDirection","swipeThreshold","onSwipeComplete","swipingDirection","onSwipe","onSwipeCancel","Animated","spring","toValue","bounciness","useNativeDriver","start","moveY","y0","moveX","x0","event","isDirectionIncluded","direction","Array","isArray","includes","draggedDown","draggedUp","draggedLeft","draggedRight","handleDimensionsUpdate","setState","open","backdropTransitionInTiming","setValue","contentRef","onModalWillShow","animate","animationInTiming","then","close","onModalShow","backdropTransitionOutTiming","onModalWillHide","animationOutTiming","onModalHide","ValueXY","console","warn","DeviceEventEmitter","addListener","removeListener","prevProps","avoidKeyboard","coverScreen","hasBackdrop","backdropColor","customBackdrop","children","deviceHeightProp","deviceWidthProp","onBackdropPress","onBackButtonPress","style","otherProps","computedStyle","margin","transform","translateY","content","panHandlers","panPosition","getTranslateTransform","getLayout","_children","hideModalContentWhileAnimating","createElement","View","containerView","ref","pointerEvents","hasCustomBackdrop","isValidElement","backdropComputedStyle","backgroundColor","backdropContent","backdrop","TouchableWithoutFeedback","onPress","containerBox","Modal","transparent","animationType","visible","onRequestClose","KeyboardAvoidingView","behavior","Platform","OS","undefined","concat","nextProps","Component","propTypes","oneOfType","string","object","number","bool","node","isRequired","func","arrayOf","oneOf","any","supportedOrientations","defaultProps"],"mappings":";;;;;;;;;;;;;;;;;AAAA,OAAO,KAAKA,KAAZ,MAAuB,OAAvB;;;;;;;;;;AAEA,OAAO,KAAKC,SAAZ,MAA2B,YAA3B;AACA,OAAO,KAAKC,UAAZ,MAA4B,yBAA5B;AACA,SAASC,oBAAT,EAA+BC,eAA/B,EAAgDC,iBAAhD;AACA,OAAOC,MAAP;AAEAH,oBAAoB;;AACpB,IAAMI,yBAAyB,GAAG,SAA5BA,yBAA4B,CAACC,KAAD;AAAA,SAAY;AAC1CC,IAAAA,WAAW,EAAED,KAAK,CAACC,WADuB;AAE1CC,IAAAA,YAAY,EAAEF,KAAK,CAACE;AAFsB,GAAZ;AAAA,CAAlC;;AAIA,WAAaC,gBAAb;AAAA;;AAAA;;AACI,4BAAYH,KAAZ,EAAmB;AAAA;;AAAA;;AACf,8BAAMA,KAAN;AAMA,UAAKI,KAAL,GAAa;AACTC,MAAAA,WAAW,EAAE,IADJ;AAETC,MAAAA,SAAS,EAAE,KAFF;AAGTC,MAAAA,WAAW,EAAEC,UAAU,CAACC,GAAX,CAAe,QAAf,EAAyBC,KAH7B;AAITC,MAAAA,YAAY,EAAEH,UAAU,CAACC,GAAX,CAAe,QAAf,EAAyBG,MAJ9B;AAKTC,MAAAA,WAAW,EAAE,MAAKb,KAAL,CAAWc,cAAX,GAA4B,IAA5B,GAAmC,KALvC;AAMTC,MAAAA,GAAG,EAAE;AANI,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KAjBY;AAkB5BrB,EAAAA,SAAS,EAAE,KAlBiB;AAmB5B+F,EAAAA,WAAW,EAAE;AAAA,WAAM,IAAN;AAAA,GAnBe;AAoB5BL,EAAAA,eAAe,EAAE;AAAA,WAAM,IAAN;AAAA,GApBW;AAqB5BS,EAAAA,WAAW,EAAE;AAAA,WAAM,IAAN;AAAA,GArBe;AAsB5BF,EAAAA,eAAe,EAAE;AAAA,WAAM,IAAN;AAAA,GAtBW;AAuB5BkB,EAAAA,eAAe,EAAE;AAAA,WAAM,IAAN;AAAA,GAvBW;AAwB5BC,EAAAA,iBAAiB,EAAE;AAAA,WAAM,IAAN;AAAA,GAxBS;AAyB5BzD,EAAAA,cAAc,EAAE,GAzBY;AA0B5BrB,EAAAA,QAAQ,EAAE,IA1BkB;AA2B5BC,EAAAA,YAAY,EAAE,CA3Bc;AA4B5BY,EAAAA,eAAe,EAAE,CA5BW;AA6B5BF,EAAAA,gBAAgB,EAAE,KA7BU;AA8B5BwH,EAAAA,qBAAqB,EAAE,CAAC,UAAD,EAAa,WAAb;AA9BK,CAAhC;AAgCA,eAAe5K,gBAAf","sourcesContent":["import * as React from 'react';\nimport { Animated, DeviceEventEmitter, Dimensions, KeyboardAvoidingView, Modal, PanResponder, Platform, TouchableWithoutFeedback, View, } from 'react-native';\nimport * as PropTypes from 'prop-types';\nimport * as animatable from 'react-native-animatable';\nimport { initializeAnimations, buildAnimations, reversePercentage, } from './utils';\nimport styles from './modal.style';\n// Override default react-native-animatable animations\ninitializeAnimations();\nconst extractAnimationFromProps = (props) => ({\n    animationIn: props.animationIn,\n    animationOut: props.animationOut,\n});\nexport class ReactNativeModal extends React.Component {\n    constructor(props) {\n        super(props);\n        // We use an internal state for keeping track of the modal visibility: this allows us to keep\n        // the modal visible during the exit animation, even if the user has already change the\n        // isVisible prop to false.\n        // We store in the state the device width and height so that we can update the modal on\n        // device rotation.\n        this.state = {\n            showContent: true,\n            isVisible: false,\n            deviceWidth: Dimensions.get('screen').width,\n            deviceHeight: Dimensions.get('screen').height,\n            isSwipeable: this.props.swipeDirection ? true : false,\n            pan: null,\n        };\n        this.isTransitioning = false;\n        this.inSwipeClosingState = false;\n        this.currentSwipingDirection = null;\n        this.panResponder = null;\n        this.buildPanResponder = () => {\n            let animEvt = null;\n            this.panResponder = PanResponder.create({\n                onMoveShouldSetPanResponder: (evt, gestureState) => {\n                    // Use propagateSwipe to allow inner content to scroll. See PR:\n                    // https://github.com/react-native-community/react-native-modal/pull/246\n                    if (!this.props.propagateSwipe) {\n                        // The number \"4\" is just a good tradeoff to make the panResponder\n                        // work correctly even when the modal has touchable buttons.\n                        // For reference:\n                        // https://github.com/react-native-community/react-native-modal/pull/197\n                        const shouldSetPanResponder = Math.abs(gestureState.dx) >= 4 || Math.abs(gestureState.dy) >= 4;\n                        if (shouldSetPanResponder && this.props.onSwipeStart) {\n                            this.props.onSwipeStart();\n                        }\n                        this.currentSwipingDirection = this.getSwipingDirection(gestureState);\n                        animEvt = this.createAnimationEventForSwipe();\n                        return shouldSetPanResponder;\n                    }\n                    return false;\n                },\n                onStartShouldSetPanResponder: (e) => {\n                    const hasScrollableView = e._dispatchInstances &&\n                        e._dispatchInstances.some((instance) => /scrollview|flatlist/i.test(instance.type));\n                    if (hasScrollableView &&\n                        this.props.propagateSwipe &&\n                        this.props.scrollTo &&\n                        this.props.scrollOffset > 0) {\n                        return false; // user needs to be able to scroll content back up\n                    }\n                    if (this.props.onSwipeStart) {\n                        this.props.onSwipeStart();\n                    }\n                    // Cleared so that onPanResponderMove can wait to have some delta\n                    // to work with\n                    this.currentSwipingDirection = null;\n                    return true;\n                },\n                onPanResponderMove: (evt, gestureState) => {\n                    // Using onStartShouldSetPanResponder we don't have any delta so we don't know\n                    // The direction to which the user is swiping until some move have been done\n                    if (!this.currentSwipingDirection) {\n                        if (gestureState.dx === 0 && gestureState.dy === 0) {\n                            return;\n                        }\n                        this.currentSwipingDirection = this.getSwipingDirection(gestureState);\n                        animEvt = this.createAnimationEventForSwipe();\n                    }\n                    if (this.isSwipeDirectionAllowed(gestureState)) {\n                        // Dim the background while swiping the modal\n                        const newOpacityFactor = 1 - this.calcDistancePercentage(gestureState);\n                        this.backdropRef &&\n                            this.backdropRef.transitionTo({\n                                opacity: this.props.backdropOpacity * newOpacityFactor,\n                            });\n                        animEvt(evt, gestureState);\n                        if (this.props.onSwipeMove) {\n                            this.props.onSwipeMove(newOpacityFactor);\n                        }\n                    }\n                    else {\n                        if (this.props.scrollTo) {\n                            if (this.props.scrollHorizontal) {\n                                let offsetX = -gestureState.dx;\n                                if (offsetX > this.props.scrollOffsetMax) {\n                                    offsetX -= (offsetX - this.props.scrollOffsetMax) / 2;\n                                }\n                                this.props.scrollTo({ x: offsetX, animated: false });\n                            }\n                            else {\n                                let offsetY = -gestureState.dy;\n                                if (offsetY > this.props.scrollOffsetMax) {\n                                    offsetY -= (offsetY - this.props.scrollOffsetMax) / 2;\n                                }\n                                this.props.scrollTo({ y: offsetY, animated: false });\n                            }\n                        }\n                    }\n                },\n                onPanResponderRelease: (evt, gestureState) => {\n                    // Call the onSwipe prop if the threshold has been exceeded on the right direction\n                    const accDistance = this.getAccDistancePerDirection(gestureState);\n                    if (accDistance > this.props.swipeThreshold &&\n                        this.isSwipeDirectionAllowed(gestureState)) {\n                        if (this.props.onSwipeComplete) {\n                            this.inSwipeClosingState = true;\n                            this.props.onSwipeComplete({\n                                swipingDirection: this.getSwipingDirection(gestureState),\n                            });\n                            return;\n                        }\n                        // Deprecated. Remove later.\n                        if (this.props.onSwipe) {\n                            this.inSwipeClosingState = true;\n                            this.props.onSwipe();\n                            return;\n                        }\n                    }\n                    //Reset backdrop opacity and modal position\n                    if (this.props.onSwipeCancel) {\n                        this.props.onSwipeCancel();\n                    }\n                    if (this.backdropRef) {\n                        this.backdropRef.transitionTo({\n                            opacity: this.props.backdropOpacity,\n                        });\n                    }\n                    Animated.spring(this.state.pan, {\n                        toValue: { x: 0, y: 0 },\n                        bounciness: 0,\n                        useNativeDriver: false,\n                    }).start();\n                    if (this.props.scrollTo) {\n                        if (this.props.scrollOffset > this.props.scrollOffsetMax) {\n                            this.props.scrollTo({\n                                y: this.props.scrollOffsetMax,\n                                animated: true,\n                            });\n                        }\n                    }\n                },\n            });\n        };\n        this.getAccDistancePerDirection = (gestureState) => {\n            switch (this.currentSwipingDirection) {\n                case 'up':\n                    return -gestureState.dy;\n                case 'down':\n                    return gestureState.dy;\n                case 'right':\n                    return gestureState.dx;\n                case 'left':\n                    return -gestureState.dx;\n                default:\n                    return 0;\n            }\n        };\n        this.getSwipingDirection = (gestureState) => {\n            if (Math.abs(gestureState.dx) > Math.abs(gestureState.dy)) {\n                return gestureState.dx > 0 ? 'right' : 'left';\n            }\n            return gestureState.dy > 0 ? 'down' : 'up';\n        };\n        this.calcDistancePercentage = (gestureState) => {\n            switch (this.currentSwipingDirection) {\n                case 'down':\n                    return ((gestureState.moveY - gestureState.y0) /\n                        ((this.props.deviceHeight || this.state.deviceHeight) -\n                            gestureState.y0));\n                case 'up':\n                    return reversePercentage(gestureState.moveY / gestureState.y0);\n                case 'left':\n                    return reversePercentage(gestureState.moveX / gestureState.x0);\n                case 'right':\n                    return ((gestureState.moveX - gestureState.x0) /\n                        ((this.props.deviceWidth || this.state.deviceWidth) - gestureState.x0));\n                default:\n                    return 0;\n            }\n        };\n        this.createAnimationEventForSwipe = () => {\n            if (this.currentSwipingDirection === 'right' ||\n                this.currentSwipingDirection === 'left') {\n                return Animated.event([null, { dx: this.state.pan.x }], {\n                    useNativeDriver: false,\n                });\n            }\n            else {\n                return Animated.event([null, { dy: this.state.pan.y }], {\n                    useNativeDriver: false,\n                });\n            }\n        };\n        this.isDirectionIncluded = (direction) => {\n            return Array.isArray(this.props.swipeDirection)\n                ? this.props.swipeDirection.includes(direction)\n                : this.props.swipeDirection === direction;\n        };\n        this.isSwipeDirectionAllowed = ({ dy, dx }) => {\n            const draggedDown = dy > 0;\n            const draggedUp = dy < 0;\n            const draggedLeft = dx < 0;\n            const draggedRight = dx > 0;\n            if (this.currentSwipingDirection === 'up' &&\n                this.isDirectionIncluded('up') &&\n                draggedUp) {\n                return true;\n            }\n            else if (this.currentSwipingDirection === 'down' &&\n                this.isDirectionIncluded('down') &&\n                draggedDown) {\n                return true;\n            }\n            else if (this.currentSwipingDirection === 'right' &&\n                this.isDirectionIncluded('right') &&\n                draggedRight) {\n                return true;\n            }\n            else if (this.currentSwipingDirection === 'left' &&\n                this.isDirectionIncluded('left') &&\n                draggedLeft) {\n                return true;\n            }\n            return false;\n        };\n        this.handleDimensionsUpdate = () => {\n            if (!this.props.deviceHeight && !this.props.deviceWidth) {\n                // Here we update the device dimensions in the state if the layout changed\n                // (triggering a render)\n                const deviceWidth = Dimensions.get('screen').width;\n                const deviceHeight = Dimensions.get('screen').height;\n                if (deviceWidth !== this.state.deviceWidth ||\n                    deviceHeight !== this.state.deviceHeight) {\n                    this.setState({ deviceWidth, deviceHeight });\n                }\n            }\n        };\n        this.open = () => {\n            if (this.isTransitioning) {\n                return;\n            }\n            this.isTransitioning = true;\n            if (this.backdropRef) {\n                this.backdropRef.transitionTo({ opacity: this.props.backdropOpacity }, this.props.backdropTransitionInTiming);\n            }\n            // This is for resetting the pan position,otherwise the modal gets stuck\n            // at the last released position when you try to open it.\n            // TODO: Could certainly be improved - no idea for the moment.\n            if (this.state.isSwipeable) {\n                this.state.pan.setValue({ x: 0, y: 0 });\n            }\n            if (this.contentRef) {\n                this.props.onModalWillShow && this.props.onModalWillShow();\n                this.contentRef\n                    .animate(this.animationIn, this.props.animationInTiming)\n                    .then(() => {\n                    this.isTransitioning = false;\n                    if (!this.props.isVisible) {\n                        this.close();\n                    }\n                    else {\n                        this.props.onModalShow();\n                    }\n                });\n            }\n        };\n        this.close = () => {\n            if (this.isTransitioning) {\n                return;\n            }\n            this.isTransitioning = true;\n            if (this.backdropRef) {\n                this.backdropRef.transitionTo({ opacity: 0 }, this.props.backdropTransitionOutTiming);\n            }\n            let animationOut = this.animationOut;\n            if (this.inSwipeClosingState) {\n                this.inSwipeClosingState = false;\n                if (this.currentSwipingDirection === 'up') {\n                    animationOut = 'slideOutUp';\n                }\n                else if (this.currentSwipingDirection === 'down') {\n                    animationOut = 'slideOutDown';\n                }\n                else if (this.currentSwipingDirection === 'right') {\n                    animationOut = 'slideOutRight';\n                }\n                else if (this.currentSwipingDirection === 'left') {\n                    animationOut = 'slideOutLeft';\n                }\n            }\n            if (this.contentRef) {\n                this.props.onModalWillHide && this.props.onModalWillHide();\n                this.contentRef\n                    .animate(animationOut, this.props.animationOutTiming)\n                    .then(() => {\n                    this.isTransitioning = false;\n                    if (this.props.isVisible) {\n                        this.open();\n                    }\n                    else {\n                        this.setState({\n                            showContent: false,\n                        }, () => {\n                            this.setState({\n                                isVisible: false,\n                            }, () => {\n                                this.props.onModalHide();\n                            });\n                        });\n                    }\n                });\n            }\n        };\n        const { animationIn, animationOut } = buildAnimations(extractAnimationFromProps(props));\n        this.animationIn = animationIn;\n        this.animationOut = animationOut;\n        if (this.state.isSwipeable) {\n            this.state = {\n                ...this.state,\n                pan: new Animated.ValueXY(),\n            };\n            this.buildPanResponder();\n        }\n        if (props.isVisible) {\n            this.state = {\n                ...this.state,\n                isVisible: true,\n                showContent: true,\n            };\n        }\n    }\n    static getDerivedStateFromProps(nextProps, state) {\n        if (!state.isVisible && nextProps.isVisible) {\n            return { isVisible: true, showContent: true };\n        }\n        return null;\n    }\n    componentDidMount() {\n        // Show deprecation message\n        if (this.props.onSwipe) {\n            console.warn('`<Modal onSwipe=\"...\" />` is deprecated and will be removed starting from 13.0.0. Use `<Modal onSwipeComplete=\"...\" />` instead.');\n        }\n        DeviceEventEmitter.addListener('didUpdateDimensions', this.handleDimensionsUpdate);\n        if (this.state.isVisible) {\n            this.open();\n        }\n    }\n    componentWillUnmount() {\n        DeviceEventEmitter.removeListener('didUpdateDimensions', this.handleDimensionsUpdate);\n    }\n    componentDidUpdate(prevProps) {\n        // If the animations have been changed then rebuild them to make sure we're\n        // using the most up-to-date ones\n        if (this.props.animationIn !== prevProps.animationIn ||\n            this.props.animationOut !== prevProps.animationOut) {\n            const { animationIn, animationOut } = buildAnimations(extractAnimationFromProps(this.props));\n            this.animationIn = animationIn;\n            this.animationOut = animationOut;\n        }\n        // If backdrop opacity has been changed then make sure to update it\n        if (this.props.backdropOpacity !== prevProps.backdropOpacity &&\n            this.backdropRef) {\n            this.backdropRef.transitionTo({ opacity: this.props.backdropOpacity }, this.props.backdropTransitionInTiming);\n        }\n        // On modal open request, we slide the view up and fade in the backdrop\n        if (this.props.isVisible && !prevProps.isVisible) {\n            this.open();\n        }\n        else if (!this.props.isVisible && prevProps.isVisible) {\n            // On modal close request, we slide the view down and fade out the backdrop\n            this.close();\n        }\n    }\n    render() {\n        /* eslint-disable @typescript-eslint/no-unused-vars */\n        const { animationIn, animationInTiming, animationOut, animationOutTiming, avoidKeyboard, coverScreen, hasBackdrop, backdropColor, backdropOpacity, backdropTransitionInTiming, backdropTransitionOutTiming, customBackdrop, children, deviceHeight: deviceHeightProp, deviceWidth: deviceWidthProp, isVisible, onModalShow, onBackdropPress, onBackButtonPress, useNativeDriver, propagateSwipe, style, ...otherProps } = this.props;\n        const deviceWidth = deviceWidthProp || this.state.deviceWidth;\n        const deviceHeight = deviceHeightProp || this.state.deviceHeight;\n        const computedStyle = [\n            { margin: deviceWidth * 0.05, transform: [{ translateY: 0 }] },\n            styles.content,\n            style,\n        ];\n        let panHandlers = {};\n        let panPosition = {};\n        if (this.state.isSwipeable) {\n            panHandlers = { ...this.panResponder.panHandlers };\n            if (useNativeDriver) {\n                panPosition = {\n                    transform: this.state.pan.getTranslateTransform(),\n                };\n            }\n            else {\n                panPosition = this.state.pan.getLayout();\n            }\n        }\n        const _children = this.props.hideModalContentWhileAnimating &&\n            this.props.useNativeDriver &&\n            !this.state.showContent ? (React.createElement(animatable.View, null)) : (children);\n        const containerView = (React.createElement(animatable.View, Object.assign({}, panHandlers, { ref: ref => (this.contentRef = ref), style: [panPosition, computedStyle], pointerEvents: \"box-none\", useNativeDriver: useNativeDriver }, otherProps), _children));\n        const hasCustomBackdrop = React.isValidElement(customBackdrop);\n        const backdropComputedStyle = [\n            {\n                width: deviceWidth,\n                height: deviceHeight,\n                backgroundColor: this.state.showContent && !hasCustomBackdrop\n                    ? backdropColor\n                    : 'transparent',\n            },\n        ];\n        const backdropContent = (React.createElement(animatable.View, { ref: ref => (this.backdropRef = ref), useNativeDriver: useNativeDriver, style: [styles.backdrop, backdropComputedStyle] }, hasCustomBackdrop && customBackdrop));\n        let backdrop = null;\n        if (hasCustomBackdrop) {\n            backdrop = backdropContent;\n        }\n        else {\n            // If there's no custom backdrop, handle presses with\n            // TouchableWithoutFeedback\n            backdrop = (React.createElement(TouchableWithoutFeedback, { onPress: onBackdropPress }, backdropContent));\n        }\n        if (!coverScreen && this.state.isVisible) {\n            return (React.createElement(View, { pointerEvents: \"box-none\", style: [styles.backdrop, styles.containerBox] },\n                hasBackdrop && backdrop,\n                containerView));\n        }\n        return (React.createElement(Modal, Object.assign({ transparent: true, animationType: 'none', visible: this.state.isVisible, onRequestClose: onBackButtonPress }, otherProps),\n            hasBackdrop && backdrop,\n            avoidKeyboard && (React.createElement(KeyboardAvoidingView, { behavior: Platform.OS === 'ios' ? 'padding' : undefined, pointerEvents: \"box-none\", style: computedStyle.concat([{ margin: 0 }]) }, containerView)),\n            !avoidKeyboard && containerView));\n    }\n}\nReactNativeModal.propTypes = {\n    animationIn: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n    animationInTiming: PropTypes.number,\n    animationOut: PropTypes.oneOfType([PropTypes.string, PropTypes.object]),\n    animationOutTiming: PropTypes.number,\n    avoidKeyboard: PropTypes.bool,\n    coverScreen: PropTypes.bool,\n    hasBackdrop: PropTypes.bool,\n    backdropColor: PropTypes.string,\n    backdropOpacity: PropTypes.number,\n    backdropTransitionInTiming: PropTypes.number,\n    backdropTransitionOutTiming: PropTypes.number,\n    customBackdrop: PropTypes.node,\n    children: PropTypes.node.isRequired,\n    deviceHeight: PropTypes.number,\n    deviceWidth: PropTypes.number,\n    isVisible: PropTypes.bool.isRequired,\n    hideModalContentWhileAnimating: PropTypes.bool,\n    propagateSwipe: PropTypes.bool,\n    onModalShow: PropTypes.func,\n    onModalWillShow: PropTypes.func,\n    onModalHide: PropTypes.func,\n    onModalWillHide: PropTypes.func,\n    onBackButtonPress: PropTypes.func,\n    onBackdropPress: PropTypes.func,\n    onSwipeStart: PropTypes.func,\n    onSwipeMove: PropTypes.func,\n    onSwipeComplete: PropTypes.func,\n    onSwipeCancel: PropTypes.func,\n    swipeThreshold: PropTypes.number,\n    swipeDirection: PropTypes.oneOfType([\n        PropTypes.arrayOf(PropTypes.oneOf(['up', 'down', 'left', 'right'])),\n        PropTypes.oneOf(['up', 'down', 'left', 'right']),\n    ]),\n    useNativeDriver: PropTypes.bool,\n    style: PropTypes.any,\n    scrollTo: PropTypes.func,\n    scrollOffset: PropTypes.number,\n    scrollOffsetMax: PropTypes.number,\n    scrollHorizontal: PropTypes.bool,\n    supportedOrientations: PropTypes.arrayOf(PropTypes.oneOf([\n        'portrait',\n        'portrait-upside-down',\n        'landscape',\n        'landscape-left',\n        'landscape-right',\n    ])),\n};\nReactNativeModal.defaultProps = {\n    animationIn: 'slideInUp',\n    animationInTiming: 300,\n    animationOut: 'slideOutDown',\n    animationOutTiming: 300,\n    avoidKeyboard: false,\n    coverScreen: true,\n    hasBackdrop: true,\n    backdropColor: 'black',\n    backdropOpacity: 0.7,\n    backdropTransitionInTiming: 300,\n    backdropTransitionOutTiming: 300,\n    customBackdrop: null,\n    useNativeDriver: false,\n    deviceHeight: null,\n    deviceWidth: null,\n    hideModalContentWhileAnimating: false,\n    propagateSwipe: false,\n    isVisible: false,\n    onModalShow: () => null,\n    onModalWillShow: () => null,\n    onModalHide: () => null,\n    onModalWillHide: () => null,\n    onBackdropPress: () => null,\n    onBackButtonPress: () => null,\n    swipeThreshold: 100,\n    scrollTo: null,\n    scrollOffset: 0,\n    scrollOffsetMax: 0,\n    scrollHorizontal: false,\n    supportedOrientations: ['portrait', 'landscape'],\n};\nexport default ReactNativeModal;\n"]},"metadata":{},"sourceType":"module"}