Skip to content

Commit

Permalink
meliorence#552 Fix snapToItem/snapToNext not working on Android devices.
Browse files Browse the repository at this point in the history
  • Loading branch information
Romick2005 committed Oct 31, 2019
1 parent c113439 commit 972dadf
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/carousel/Carousel.js
Original file line number Diff line number Diff line change
Expand Up @@ -910,6 +910,10 @@ export default class Carousel extends Component {
return;
}

// Check if it is just tap event (not swipe)
if (this._currentContentOffset === this._scrollEndOffset) {
return;
}
this._scrollEndOffset = this._currentContentOffset;
this._scrollEndActive = this._getActiveItem(this._scrollEndOffset);

Expand Down Expand Up @@ -1034,6 +1038,9 @@ export default class Carousel extends Component {

this._scrollTo(this._scrollOffsetRef, animated);

// Store scroll end position to differentiating between a tap and a swipe event
this._scrollEndOffset = this._currentContentOffset;

if (enableMomentum) {
// iOS fix, check the note in the constructor
if (!initial) {
Expand Down Expand Up @@ -1100,7 +1107,7 @@ export default class Carousel extends Component {

pauseAutoPlay () {
this._autoplaying = false;
clearInterval(this._autoplayInterval);
clearInterval(this._autoplayInterval);
}

stopAutoplay () {
Expand Down

0 comments on commit 972dadf

Please sign in to comment.