Skip to content

Commit cd17949

Browse files
committed
fix: autoPlay dont work
1 parent 1bd8ce3 commit cd17949

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

index.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export default class Slide extends React.Component{
5050
componentWillReceiveProps(newProps){
5151
let newState = this._getStateFromProps(newProps);
5252
this.setState(newState);
53+
clearTimeout(this.timer);
5354
React.Children.count(this.state.children) && this.state.autoPlay && this._autoPlay();
5455
}
5556

@@ -92,7 +93,6 @@ export default class Slide extends React.Component{
9293

9394
_autoPlay(){
9495
var interval = this.state.autoPlay;
95-
clearTimeout(this.timer);
9696
this.timer = setTimeout(() => {
9797
if(Platform.OS === 'ios'){
9898
this.setState({

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-slide",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"description": "react-native-slide",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)