forked from voronianski/react-swipe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
react-swipe.min.js
1 lines (1 loc) · 1.49 KB
/
react-swipe.min.js
1
!function(e,o){"undefined"!=typeof module&&module.exports?module.exports=o(require("react"),require("react-dom"),require("swipe-js-iso"),require("object-assign")):e.ReactSwipe=o(e.React,e.ReactDOM,e.Swipe,e.objectAssign)}(this,function(e,o,i,t){var s={container:{overflow:"hidden",visibility:"hidden",position:"relative"},wrapper:{overflow:"hidden",position:"relative"},child:{"float":"left",width:"100%",position:"relative",transitionProperty:"transform"}},p=e.createClass({propTypes:{startSlide:e.PropTypes.number,slideToIndex:e.PropTypes.number,shouldUpdate:e.PropTypes.func,speed:e.PropTypes.number,auto:e.PropTypes.number,continuous:e.PropTypes.bool,disableScroll:e.PropTypes.bool,stopPropagation:e.PropTypes.bool,callback:e.PropTypes.func,transitionEnd:e.PropTypes.func},componentDidMount:function(){this.swipe=i(o.findDOMNode(this),t({},this.props))},componentDidUpdate:function(){(this.props.slideToIndex||0===this.props.slideToIndex)&&this.swipe.slide(this.props.slideToIndex)},componentWillUnmount:function(){this.swipe.kill(),delete this.swipe},shouldComponentUpdate:function(e){return this.props.slideToIndex!==e.slideToIndex||"undefined"!=typeof this.props.shouldUpdate&&this.props.shouldUpdate(e)},render:function(){return e.createElement("div",e.__spread({},{style:s.container},this.props),e.createElement("div",{style:s.wrapper},e.Children.map(this.props.children,function(o){return e.cloneElement(o,{ref:o.props.ref,key:o.props.key,style:o.props.style?t(o.props.style,s.child):s.child})})))}});return p});