From c9069b92dc993b1872d8807ee62e45e14ae153f2 Mon Sep 17 00:00:00 2001 From: RyotaSugawara Date: Fri, 1 Sep 2017 20:51:49 +0900 Subject: [PATCH] bug fix animation timing --- src/index.tsx | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 030ec94..d211ef4 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -335,17 +335,20 @@ export default class Carousel extends React.Component { setTimeout(() => { this.setState({ - animate: false, - currentIndex: index, - showIndex: null, swipePosition: 0 }, () => { - this.moving = false; - this.resetAutoSlide(); + this.setState({ + animate: false, + showIndex: null, + currentIndex: index, + }, () => { + this.moving = false; + this.resetAutoSlide(); + }); }); }, this.props.duration); }); - }, 1000 / 60); // wait 1 frame (at 60fps) for animate + }, 1000 / 60 * 2); // wait 2 frame (at 60fps) for animate }); }