From a70c0ac5f4957fef1aaea555a771ee4b8eb60996 Mon Sep 17 00:00:00 2001 From: neverland Date: Wed, 25 Sep 2019 15:11:23 +0800 Subject: [PATCH] fix(Swipe): incorrect swipeTo animation (#4570) --- src/swipe/index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/swipe/index.js b/src/swipe/index.js index 556ccd4fe..422be52a7 100644 --- a/src/swipe/index.js +++ b/src/swipe/index.js @@ -254,8 +254,15 @@ export default createComponent({ this.correctPosition(); doubleRaf(() => { + let targetIndex; + if (this.loop && index === this.count) { + targetIndex = this.active === 0 ? 0 : index; + } else { + targetIndex = index % this.count; + } + this.move({ - pace: (index % this.count) - this.active, + pace: targetIndex - this.active, emitChange: true });