UNPKG

@gem-mine/rmc-calendar

Version:

React Mobile Calendar Component(web and react-native)

50 lines (39 loc) 1.62 kB
import _classCallCheck from 'babel-runtime/helpers/classCallCheck'; import _possibleConstructorReturn from 'babel-runtime/helpers/possibleConstructorReturn'; import _inherits from 'babel-runtime/helpers/inherits'; import React from 'react'; var AnimateWrapper = function (_React$PureComponent) { _inherits(AnimateWrapper, _React$PureComponent); function AnimateWrapper() { _classCallCheck(this, AnimateWrapper); var _this = _possibleConstructorReturn(this, _React$PureComponent.apply(this, arguments)); _this.handlePreventDefault = function (e) { e.preventDefault(); }; return _this; } AnimateWrapper.prototype.componentDidMount = function componentDidMount() { this.aniRef.addEventListener('touchmove', this.handlePreventDefault, { passive: false }); }; AnimateWrapper.prototype.render = function render() { var _this2 = this; var _props = this.props, className = _props.className, displayType = _props.displayType, visible = _props.visible, onClose = _props.onClose; return React.createElement( 'div', { ref: function ref(dom) { return _this2.aniRef = dom; }, className: className + ' animate', style: { display: visible ? displayType : 'none' }, onClick: onClose }, visible && this.props.children ); }; return AnimateWrapper; }(React.PureComponent); export default AnimateWrapper; AnimateWrapper.defaultProps = { className: '', displayType: 'flex' };