react-free-carousel
Advanced tools
Comparing version 0.1.7 to 0.1.8
@@ -68,12 +68,15 @@ 'use strict'; | ||
}, 100); | ||
// //debug | ||
// setInterval(() => { | ||
// this.reRender(false); | ||
// }, 5000); | ||
} | ||
}, { | ||
key: 'componentWillReceiveProps', | ||
value: function componentWillReceiveProps() { | ||
var _this3 = this; | ||
setTimeout(function () { | ||
_this3.reRender(false); | ||
}, 100); | ||
} | ||
// componentWillReceiveProps() { | ||
// setTimeout(() => { | ||
// this.reRender(false); | ||
// }, 100); | ||
// } | ||
}, { | ||
@@ -88,3 +91,3 @@ key: 'componentWillUnmount', | ||
value: function reRender() { | ||
var _this4 = this; | ||
var _this3 = this; | ||
@@ -103,7 +106,7 @@ var scrollToStart = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; | ||
setTimeout(function () { | ||
_this4.setState({ | ||
_this3.setState({ | ||
page: page, | ||
pages: totalPages | ||
}, function () { | ||
_this4.playCarousel(); | ||
_this3.playCarousel(); | ||
}); | ||
@@ -115,9 +118,9 @@ }, this.props.transitionSpeed + 50); | ||
value: function playCarousel() { | ||
var _this5 = this; | ||
var _this4 = this; | ||
if (this.state.pages > 0 && this.props.autoplay && this.props.interval) { | ||
this.slidingInterval = setInterval(function () { | ||
var page = _this5.state.page === _this5.state.pages ? 0 : _this5.state.page + 1; | ||
var page = _this4.state.page === _this4.state.pages ? 0 : _this4.state.page + 1; | ||
_this5.gotoPage(page); | ||
_this4.gotoPage(page); | ||
}, this.props.interval); | ||
@@ -136,3 +139,3 @@ } | ||
value: function gotoPage(page) { | ||
var _this6 = this; | ||
var _this5 = this; | ||
@@ -143,3 +146,3 @@ var newPage = page > this.state.pages ? 0 : page; | ||
this.setState({ page: newPage }, function () { | ||
_this6.playCarousel(); | ||
_this5.playCarousel(); | ||
}); | ||
@@ -222,3 +225,3 @@ (0, _jquery2.default)(this.container).css('margin-left', '-' + this.pageToOffset(newPage) + 'px'); | ||
value: function renderPagination() { | ||
var _this7 = this; | ||
var _this6 = this; | ||
@@ -230,3 +233,3 @@ return _react2.default.createElement( | ||
ref: function ref(node) { | ||
_this7.pagination = node; | ||
_this6.pagination = node; | ||
}, | ||
@@ -239,7 +242,7 @@ role: 'navigation' }, | ||
'aria-label': 'Goto Page ' + (i + 1), | ||
className: '\n ' + _this7.props.paginationDotClass + '\n ' + (i === _this7.state.page ? _this7.props.paginationDotActiveClass : ''), | ||
'data-active': i === _this7.state.page ? 'true' : 'false', | ||
className: '\n ' + _this6.props.paginationDotClass + '\n ' + (i === _this6.state.page ? _this6.props.paginationDotActiveClass : ''), | ||
'data-active': i === _this6.state.page ? 'true' : 'false', | ||
key: i, | ||
onClick: function onClick() { | ||
_this7.gotoPage(i); | ||
_this6.gotoPage(i); | ||
} }, | ||
@@ -254,10 +257,10 @@ i + 1 | ||
value: function renderArrows(kind) { | ||
var _this8 = this; | ||
var _this7 = this; | ||
var calculateNextPage = function calculateNextPage(direction) { | ||
if (direction === 'next' && _this8.state.page < _this8.state.pages) { | ||
return _this8.state.page + 1; | ||
if (direction === 'next' && _this7.state.page < _this7.state.pages) { | ||
return _this7.state.page + 1; | ||
} | ||
if (direction === 'prev' && _this8.state.page > 0) { | ||
return _this8.state.page - 1; | ||
if (direction === 'prev' && _this7.state.page > 0) { | ||
return _this7.state.page - 1; | ||
} | ||
@@ -273,3 +276,3 @@ return null; | ||
onClick: function onClick() { | ||
_this8.gotoPage(nextPage); | ||
_this7.gotoPage(nextPage); | ||
}, | ||
@@ -282,3 +285,3 @@ role: 'button', | ||
value: function render() { | ||
var _this9 = this; | ||
var _this8 = this; | ||
@@ -327,3 +330,3 @@ var _props = this.props, | ||
ref: function ref(node) { | ||
_this9.wrapper = node; | ||
_this8.wrapper = node; | ||
}, | ||
@@ -338,3 +341,3 @@ style: wrapperStyling }, | ||
ref: function ref(node) { | ||
_this9.container = node; | ||
_this8.container = node; | ||
}, | ||
@@ -341,0 +344,0 @@ style: containerStyling }, |
{ | ||
"name": "react-free-carousel", | ||
"version": "0.1.7", | ||
"version": "0.1.8", | ||
"description": "Carousel component for free flex-box layout built with React.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -26,10 +26,15 @@ import React from 'react'; | ||
}, 100); | ||
} | ||
componentWillReceiveProps() { | ||
setTimeout(() => { | ||
this.reRender(false); | ||
}, 100); | ||
// //debug | ||
// setInterval(() => { | ||
// this.reRender(false); | ||
// }, 5000); | ||
} | ||
// componentWillReceiveProps() { | ||
// setTimeout(() => { | ||
// this.reRender(false); | ||
// }, 100); | ||
// } | ||
componentWillUnmount() { | ||
@@ -36,0 +41,0 @@ this.stopCarousel(); |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
844693
10346