Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复4.0.5版本下ScrollView内嵌Swiper时,Swiper滑动无响应的问题 #16563

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

zhengyanan1
Copy link
Contributor

这个 PR 做了什么? (简要描述所做更改)

问题表象:@tarojs/components 4.0.5版本下,使用ScrollView内嵌Swiper时,滑动Swiper失效。

问题原因:
@tarojs/components 4.0.5版本里,引用的swiper版本是11.1.0。这个版本的swiper的滑动监听touchmove默认绑定在document上(冒泡阶段)。
但使用ScrollView时,在touchmove中会调用event.stopPropagation()拦截掉事件的冒泡,导致其内嵌的Swiper滑动无响应。

问题处理思路:
修改默认参数nested,将其默认设置为true。这样的话,swiper的touchmove还是document上监听,但是是捕获阶段监听,就不会被ScrollView拦截掉。

这个 PR 是什么类型? (至少选择一个)

  • 错误修复(Bugfix) issue: fix #
  • 新功能(Feature)
  • 代码重构(Refactor)
  • TypeScript 类型定义修改(Typings)
  • 文档修改(Docs)
  • 代码风格更新(Code style update)
  • 其他,请描述(Other, please describe):

这个 PR 涉及以下平台:

  • 所有小程序
  • 微信小程序
  • 支付宝小程序
  • 百度小程序
  • 字节跳动小程序
  • QQ 轻应用
  • 京东小程序
  • 快应用平台(QuickApp)
  • Web 平台(H5)
  • 移动端(React-Native)
  • 鸿蒙(harmony)

Copy link

codecov bot commented Sep 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 58.51%. Comparing base (5f249fd) to head (7baa27c).
Report is 1 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff            @@
##             main   #16563    +/-   ##
========================================
  Coverage   58.51%   58.51%            
========================================
  Files         466      466            
  Lines       27109    27109            
  Branches     5705     5950   +245     
========================================
  Hits        15862    15862            
+ Misses       9926     9735   -191     
- Partials     1321     1512   +191     
Flag Coverage Δ
taro-cli 73.67% <ø> (ø)
taro-runtime 59.83% <ø> (ø)
taro-web 52.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
...s/taro-components/src/components/swiper/swiper.tsx 34.64% <ø> (ø)

... and 36 files with indirect coverage changes

@ZEJIA-LIU ZEJIA-LIU merged commit d288a41 into main Sep 20, 2024
23 checks passed
@ZEJIA-LIU ZEJIA-LIU deleted the fix-4.0.5-swiper_unresponse branch September 20, 2024 07:24
This was referenced Sep 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants