Skip to content

Commit

Permalink
Merge pull request #648 from sergeyzhukov/fix/snapToItem
Browse files Browse the repository at this point in the history
Fix for incorrect snapToItem
  • Loading branch information
Benoît Delmaire authored Apr 3, 2020
2 parents fc5f7cd + 9a42e4e commit 5da199a
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions 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;
}

if (this._currentContentOffset === this._scrollEndOffset) {
return;
}

this._scrollEndOffset = this._currentContentOffset;
this._scrollEndActive = this._getActiveItem(this._scrollEndOffset);

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

this._scrollTo(this._scrollOffsetRef, animated);

this._scrollEndOffset = this._currentContentOffset;

if (enableMomentum) {
// iOS fix, check the note in the constructor
if (!initial) {
Expand Down

0 comments on commit 5da199a

Please sign in to comment.