@@ -85,9 +85,9 @@ class InfiniteCarousel extends Component {
8585 breakpoints : breakpointsSettings ,
8686 } = this . props ;
8787 const { scrollOnDeviceProps : stateScrollOnDeviceProps } = this . state ;
88- const breakpoints = breakpointsSettings . map ( element => element . breakpoint ) ;
88+ const breakpoints = breakpointsSettings . map ( ( element ) => element . breakpoint ) ;
8989 const settings = { } ;
90- breakpointsSettings . forEach ( element => {
90+ breakpointsSettings . forEach ( ( element ) => {
9191 settings [ element . breakpoint ] = element . settings ;
9292 } ) ;
9393 if ( breakpoints . length > 0 ) {
@@ -117,7 +117,7 @@ class InfiniteCarousel extends Component {
117117 ...scrollOnDeviceProps ,
118118 } ;
119119 const children = this . getChildrenList ( propChildren , newSettings . slidesToShow ) ;
120- const slideUniqueIds = children . map ( child => uniqid ( 'slide-' ) ) ; // eslint-disable-line no-unused-vars
120+ const slideUniqueIds = children . map ( ( child ) => uniqid ( 'slide-' ) ) ; // eslint-disable-line no-unused-vars
121121 this . setState (
122122 {
123123 settings : newSettings ,
@@ -143,7 +143,7 @@ class InfiniteCarousel extends Component {
143143 ...scrollOnDeviceProps ,
144144 } ;
145145 const children = this . getChildrenList ( propChildren , newSettings . slidesToShow ) ;
146- const slideUniqueIds = children . map ( child => uniqid ( 'slide-' ) ) ; // eslint-disable-line no-unused-vars
146+ const slideUniqueIds = children . map ( ( child ) => uniqid ( 'slide-' ) ) ; // eslint-disable-line no-unused-vars
147147 this . setState (
148148 {
149149 settings : newSettings ,
@@ -175,7 +175,8 @@ class InfiniteCarousel extends Component {
175175 } ;
176176
177177 setDimensions = ( ) => {
178- const { settings, lowerBreakpoint, higherBreakpoint, children, currentIndex } = this . state ;
178+ const { settings, lowerBreakpoint, higherBreakpoint, children, currentIndex, autoCycleTimer } =
179+ this . state ;
179180 const { children : propChildren , scrollOnDevice : propScrollOnDevice } = this . props ;
180181 const scrollOnDevice = propScrollOnDevice && isTouchDevice ( ) ;
181182 const currentScreenWidth = getScreenWidth ( ) ;
@@ -203,6 +204,7 @@ class InfiniteCarousel extends Component {
203204 visibleSlideList = this . getVisibleIndexes ( propChildren , currentIndex ) ;
204205 }
205206
207+ clearInterval ( autoCycleTimer ) ;
206208 this . setState (
207209 {
208210 activePage,
@@ -214,6 +216,8 @@ class InfiniteCarousel extends Component {
214216 lazyLoadedList,
215217 visibleSlideList,
216218 sideSize,
219+ // clear autocycle
220+ autoCycleTimer : null ,
217221 } ,
218222 ( ) => {
219223 this . playAutoCycle ( ) ;
@@ -353,7 +357,7 @@ class InfiniteCarousel extends Component {
353357 return targetIndex ;
354358 } ;
355359
356- onDotClick = event => {
360+ onDotClick = ( event ) => {
357361 event . preventDefault ( ) ;
358362 const { settings, animating, autoCycleTimer } = this . state ;
359363 const { slidesToShow, autoCycle } = settings ;
@@ -406,7 +410,7 @@ class InfiniteCarousel extends Component {
406410 }
407411 } ;
408412
409- onSwipeStart = e => {
413+ onSwipeStart = ( e ) => {
410414 const {
411415 settings : { swipe, draggable } ,
412416 } = this . state ;
@@ -433,7 +437,7 @@ class InfiniteCarousel extends Component {
433437 return true ;
434438 } ;
435439
436- onSwipeMove = e => {
440+ onSwipeMove = ( e ) => {
437441 const { dragging, animating } = this . state ;
438442 if ( ! dragging ) {
439443 e . preventDefault ( ) ;
@@ -527,15 +531,8 @@ class InfiniteCarousel extends Component {
527531
528532 getTrackStyles = ( ) => {
529533 const { settings } = this . state ;
530- const {
531- touchObject,
532- singlePage,
533- sideSize,
534- animating,
535- slidesWidth,
536- slidesCount,
537- currentIndex,
538- } = this . state ;
534+ const { touchObject, singlePage, sideSize, animating, slidesWidth, slidesCount, currentIndex } =
535+ this . state ;
539536 let trackWidth = slidesWidth + settings . slidesSpacing * 2 ;
540537 trackWidth *= slidesCount + settings . slidesToShow * 2 ;
541538 const totalSlideWidth = slidesWidth + settings . slidesSpacing * 2 ;
@@ -579,7 +576,7 @@ class InfiniteCarousel extends Component {
579576 MozBoxSizing : 'border-box' ,
580577 } ;
581578
582- getSlideStyles = isVisible => {
579+ getSlideStyles = ( isVisible ) => {
583580 const { slidesWidth, settings } = this . state ;
584581 const { scrollOnDevice } = this . props ;
585582 const isScrollTouch = scrollOnDevice && isTouchDevice ( ) ;
@@ -745,7 +742,7 @@ class InfiniteCarousel extends Component {
745742 }
746743 } ;
747744
748- moveToNext = event => {
745+ moveToNext = ( event ) => {
749746 const { onNextClick } = this . props ;
750747 const { animating, settings, currentIndex, autoCycleTimer } = this . state ;
751748 event . preventDefault ( ) ;
@@ -770,7 +767,7 @@ class InfiniteCarousel extends Component {
770767 }
771768 } ;
772769
773- moveToPrevious = event => {
770+ moveToPrevious = ( event ) => {
774771 const { onPreviousClick } = this . props ;
775772 const { animating, settings, currentIndex, autoCycleTimer } = this . state ;
776773 event . preventDefault ( ) ;
@@ -826,7 +823,7 @@ class InfiniteCarousel extends Component {
826823 const settings = this . getSettingsForScrollOnDevice ( ) ;
827824 const { slidesToShow } = settings ;
828825 const newChildren = this . getChildrenList ( children , slidesToShow ) ;
829- const slideUniqueIds = newChildren . map ( child => uniqid ( 'slide-' ) ) ; // eslint-disable-line no-unused-vars
826+ const slideUniqueIds = newChildren . map ( ( child ) => uniqid ( 'slide-' ) ) ; // eslint-disable-line no-unused-vars
830827 this . setState (
831828 {
832829 children : newChildren ,
@@ -840,7 +837,7 @@ class InfiniteCarousel extends Component {
840837 }
841838 } ;
842839
843- storeFrameRef = f => {
840+ storeFrameRef = ( f ) => {
844841 if ( f !== null ) {
845842 this . frame = f ;
846843 }
0 commit comments