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

taro 3.4.14 H5中下拉刷新与ScrollView 下拉冲突 #13697

Closed
PL-FE opened this issue Apr 20, 2023 · 5 comments · Fixed by #14555, #14582 or #14586
Closed

taro 3.4.14 H5中下拉刷新与ScrollView 下拉冲突 #13697

PL-FE opened this issue Apr 20, 2023 · 5 comments · Fixed by #14555, #14582 or #14586
Labels
A-components Area - H5 组件库相关 E-medium Helper Wanted - Medium F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x

Comments

@PL-FE
Copy link

PL-FE commented Apr 20, 2023

相关平台

H5

复现仓库

https://github.com/PL-FE/taro-h5.git
浏览器版本: Chrome 111.0.5563.149
使用框架: React

复现步骤

使用移动端运行代码 npm run dev:h5或者访问在线demo:https://jrpg8g-10086.csb.app/#/pages/index/index
将数据下拉到底,然后使用将数据滚动回来(注意使用鼠标时,需要按左键模拟触摸屏,不使用滚轮),实际是无法滚动回来,会同时触发下拉刷新

期望结果

期望使用scrollView可以正常上下滚动,scrollView内容到顶部才会触发页面下拉刷新

实际结果

期望使用scrollView不可以正常上下滚动,scrollView内容未到顶部也会触发页面下拉刷新。

环境信息


  Taro CLI 3.4.14 environment info:
    System:
      OS: Windows 10
    Binaries:
      Node: 14.19.0 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
      npm: 6.14.16 - C:\Program Files\nodejs\npm.CMD
@TheKonka TheKonka added V-3 Version - 3.x F-react Framework - React T-h5 Target - 编译到 H5 labels Apr 20, 2023
@PL-FE
Copy link
Author

PL-FE commented Apr 21, 2023

xdm,看了下源码是判断是否存在滚动条那里判断得不对,取的是page容器的滚动条。
node_modules@tarojs\components\dist\esm-es5\taro-pull-to-refresh.entry.js,可以直接在这里调试。
编译前的文件:node_modules@tarojs\components\dist\collection\components\pull-to-refresh\pull-to-refresh.js
image

临时解决方案:

  onTouchMove(e) {
    if (this.state.scrollTop !== 0) {
      e.stopPropagation();
    }
  }

  onScroll(e) {
    this.setState({
      scrollTop: e.detail.scrollTop,
    });
  }

 <ScrollView
      onScroll={(e) => this.onScroll(e)}
      onTouchMove={(e) => this.onTouchMove(e)}
    >

@ZakaryCode
Copy link
Contributor

看你的补充的代码并不包括 #11747,这在 v3.4.9 就已经合并了,可以关注实际使用版本,或者尝试升级修复问题

@ZakaryCode ZakaryCode added question Further information is requested to be closed labels Apr 21, 2023
@PL-FE
Copy link
Author

PL-FE commented Apr 21, 2023

跳转进入到可下拉刷新的页面无法下拉刷新

看你的补充的代码并不包括 #11747,这在 v3.4.9 就已经合并了,可以关注实际使用版本,或者尝试升级修复问题

合并的是,跳转进入到可下拉刷新的页面无法下拉刷新
我遇到的是,当 scrollview 存在时,当scrollview 滚动条在中间时,下拉scrollview 同样会触发页面的下拉刷新。期望scrollview内滚动条ScrollTop 不等于0 时不触发页面的下拉刷新。

@ZakaryCode ZakaryCode added E-medium Helper Wanted - Medium and removed question Further information is requested to be closed labels Apr 21, 2023
@ZakaryCode
Copy link
Contributor

我遇到的是,当 scrollview 存在时,当scrollview 滚动条在中间时,下拉scrollview 同样会触发页面的下拉刷新。期望scrollview内滚动条ScrollTop 不等于0 时不触发页面的下拉刷新。

虽然不建议这么使用,不过这个需求也挺合理的,可以根据 target 判断下,欢迎 PR

@ZakaryCode ZakaryCode added the A-components Area - H5 组件库相关 label Apr 21, 2023
@PL-FE
Copy link
Author

PL-FE commented Apr 21, 2023

好的,感谢,我尝试下。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-components Area - H5 组件库相关 E-medium Helper Wanted - Medium F-react Framework - React T-h5 Target - 编译到 H5 V-3 Version - 3.x
Projects
Archived in project
3 participants