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

[Bug Report] 当使用固定高度的 List + PullRefresh 时。滑动列表内滑动到顶部时无法触发下拉刷新 #881

Open
r3x5ur opened this issue Jan 9, 2025 · 1 comment

Comments

@r3x5ur
Copy link

r3x5ur commented Jan 9, 2025

问题出在哪个包

@taroify/core

问题出在哪个平台/设备/浏览器

H5, 微信小程序

平台/设备/浏览器

No response

你正在使用的 Taroify 版本是多少

0.6.2-alpha.0

描述一下您遇到的问题以及重现步骤

当使用固定高度 List + PullRefresh 时。滑动列表内滑动到顶部时无法触发下拉刷新

查看源码看到固定高度的列表渲染的是 scroll-view

而这个组件阻止了 touchmove 的冒泡。https://github.com/NervJS/taro/blob/main/packages/taro-components/src/components/scroll-view/scroll-view.tsx#L125

如果可能的话,请包含一个代码框的链接与复制的问题

https://taroify.github.io/taroify.com/components/list/

你知道如何解决这个问题吗

None

您是否愿意参与修复这个问题,并创建一个 PR

None

修复这个问题的解决方案

可能需要与常规使用一样 渲染一个 普通的 View ?好像也不行,需要监听 onScroll 来判断是否触底,一时间也没想到很好的办法

@r3x5ur r3x5ur changed the title [Bug Report] [Bug Report] 当使用固定高度的 List + PullRefresh 时。滑动列表内滑动到顶部时无法触发下拉刷新 Jan 9, 2025
@r3x5ur
Copy link
Author

r3x5ur commented Jan 10, 2025

解决方案可能需要 patch 这个位置
https://github.com/NervJS/taro/blob/main/packages/taro-components/src/components/scroll-view/scroll-view.tsx#L125

image
↓↓↓↓

image

diff --git a/dist/components/taro-scroll-view-core.js b/dist/components/taro-scroll-view-core.js
index 3fbf3df816de8545b204b85ebb0026f1bf2888a9..64137fde7dc071a9b1e242e3159ab9064f4388f7 100644
--- a/dist/components/taro-scroll-view-core.js
+++ b/dist/components/taro-scroll-view-core.js
@@ -101,7 +101,7 @@ const ScrollView = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
   handleTouchMove(e) {
     if (e instanceof CustomEvent)
       return;
-    e.stopPropagation();
+    this._scrollTop > 0 && e.stopPropagation();
   }
   async mpScrollToMethod(object) {
     let { top, left, duration, animated = false } = object;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant