From 102a3e4b4ed739ab924482b9e92d8374ec0db19f Mon Sep 17 00:00:00 2001 From: neverland Date: Tue, 23 Nov 2021 20:57:34 +0800 Subject: [PATCH] fix(Swipe): should prevent touchmove event when swiping (#9918) --- src/swipe/index.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/swipe/index.js b/src/swipe/index.js index 401db97cd..01b841964 100644 --- a/src/swipe/index.js +++ b/src/swipe/index.js @@ -210,8 +210,16 @@ export default createComponent({ this.touchMove(event); - if (this.isCorrectDirection) { + // if user starting to touchmove, prevent the event bubbling to + // avoid affecting the parent components + const shouldPrevent = + this.isCorrectDirection || + this.offsetY > this.offsetX === this.vertical; + if (shouldPrevent) { preventDefault(event, this.stopPropagation); + } + + if (this.isCorrectDirection) { this.move({ offset: this.delta }); } },