mirror of
https://github.com/zhigang1992/react-native-swiper.git
synced 2026-01-12 17:42:56 +08:00
Auto play issue when only a child view | fixes #19
This commit is contained in:
4
dist/index.js
vendored
4
dist/index.js
vendored
@@ -209,7 +209,7 @@ module.exports = _reactNative2.default.createClass({
|
||||
autoplay: function autoplay() {
|
||||
var _this = this;
|
||||
|
||||
if (!this.props.autoplay || this.state.isScrolling || this.state.autoplayEnd) return;
|
||||
if (!Array.isArray(this.props.children) || !this.props.autoplay || this.state.isScrolling || this.state.autoplayEnd) return;
|
||||
|
||||
clearTimeout(this.autoplayTimer);
|
||||
|
||||
@@ -302,7 +302,7 @@ module.exports = _reactNative2.default.createClass({
|
||||
* @param {number} index offset index
|
||||
*/
|
||||
scrollTo: function scrollTo(index) {
|
||||
if (this.state.isScrolling) return;
|
||||
if (this.state.isScrolling || this.state.total < 2) return;
|
||||
var state = this.state;
|
||||
var diff = (this.props.loop ? 1 : 0) + index + this.state.index;
|
||||
var x = 0;
|
||||
|
||||
@@ -209,7 +209,7 @@ module.exports = _reactNative2.default.createClass({
|
||||
autoplay: function autoplay() {
|
||||
var _this = this;
|
||||
|
||||
if (!this.props.autoplay || this.state.isScrolling || this.state.autoplayEnd) return;
|
||||
if (!Array.isArray(this.props.children) || !this.props.autoplay || this.state.isScrolling || this.state.autoplayEnd) return;
|
||||
|
||||
clearTimeout(this.autoplayTimer);
|
||||
|
||||
@@ -302,7 +302,7 @@ module.exports = _reactNative2.default.createClass({
|
||||
* @param {number} index offset index
|
||||
*/
|
||||
scrollTo: function scrollTo(index) {
|
||||
if (this.state.isScrolling) return;
|
||||
if (this.state.isScrolling || this.state.total < 2) return;
|
||||
var state = this.state;
|
||||
var diff = (this.props.loop ? 1 : 0) + index + this.state.index;
|
||||
var x = 0;
|
||||
|
||||
@@ -206,7 +206,8 @@ module.exports = React.createClass({
|
||||
* Automatic rolling
|
||||
*/
|
||||
autoplay() {
|
||||
if(!this.props.autoplay
|
||||
if(!Array.isArray(this.props.children)
|
||||
|| !this.props.autoplay
|
||||
|| this.state.isScrolling
|
||||
|| this.state.autoplayEnd) return
|
||||
|
||||
@@ -301,7 +302,7 @@ module.exports = React.createClass({
|
||||
* @param {number} index offset index
|
||||
*/
|
||||
scrollTo(index) {
|
||||
if(this.state.isScrolling) return
|
||||
if (this.state.isScrolling || this.state.total < 2) return
|
||||
let state = this.state
|
||||
let diff = (this.props.loop ? 1 : 0) + index + this.state.index
|
||||
let x = 0
|
||||
|
||||
Reference in New Issue
Block a user