Skip to content

fix(pickerview): 修改快速滚动偶现滑动错位问题#3278

Merged
xiaoyatong merged 8 commits intojdf2e:feat_v3.xfrom
irisSong:bugfix_pickerview_3.x
Jun 26, 2025
Merged

fix(pickerview): 修改快速滚动偶现滑动错位问题#3278
xiaoyatong merged 8 commits intojdf2e:feat_v3.xfrom
irisSong:bugfix_pickerview_3.x

Conversation

@irisSong
Copy link
Collaborator

@irisSong irisSong commented Jun 26, 2025

…nto feat_v3.x

🤔 这个变动的性质是?

  • 新特性提交
  • 日常 bug 修复
  • 站点、文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • TypeScript 定义更新
  • 包体积优化
  • 性能优化
  • 功能增强
  • 国际化改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他改动(是关于什么的改动?)

🔗 相关 Issue

💡 需求背景和解决方案

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • fork仓库代码是否为最新避免文件冲突
  • Files changed 没有 package.json lock 等无关文件

Summary by CodeRabbit

  • Bug Fixes
    • 修复了滚轮滚动过程中动量滚动被过早终止的问题,提升了滚动体验的流畅性。

@github-actions github-actions bot added action:review This PR needs more reviews (less than 2 approvals) 3.x Target branch 3.x labels Jun 26, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jun 26, 2025

Walkthrough

本次更改在滚轮组件中引入了 isScroll 引用,用于追踪当前是否处于滚动交互状态。通过在触摸事件开始和结束时设置该标志,优化了滚动结束时机的判断,避免在滚动过程中过早停止动量滚动。

Changes

文件/文件组 变更摘要
src/packages/pickerview/pickerroller.taro.tsx 新增 isScroll 标志,优化滚动结束逻辑处理

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant PickerRoller
  participant isScroll

  User->>PickerRoller: handleTouchStart
  PickerRoller->>isScroll: isScroll.current = true

  User->>PickerRoller: handleTouchEnd
  PickerRoller->>isScroll: isScroll.current = false

  PickerRoller->>PickerRoller: onTransitionEnd
  alt isScroll.current == false
    PickerRoller->>PickerRoller: stopMomentumScroll()
  end
Loading

Suggested reviewers

  • xiaoyatong
  • oasis-cloud

Poem

滚轮轻转兔儿忙,
新增标记防误伤。
触摸起止细分明,
动量滚动不慌张。
代码如风随指舞,
🐇欢跳共成长!


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 737d9e2 and 157b518.

📒 Files selected for processing (1)
  • src/packages/pickerview/pickerroller.taro.tsx (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: test
  • GitHub Check: build
🔇 Additional comments (5)
src/packages/pickerview/pickerroller.taro.tsx (5)

110-110: 引入滚动状态追踪,解决方案设计合理

新增的 isScroll ref 用于追踪当前是否处于滚动交互状态,这是解决快速滚动时滑动错位问题的关键设计。


113-113: 正确设置滚动开始标志

在触摸开始时将滚动标志设置为 true,标记滚动交互的开始,时机选择恰当。


140-140: 正确重置滚动结束标志

在触摸结束时将滚动标志重置为 false,确保滚动交互状态的准确追踪。


252-256: 核心修复逻辑实现正确

新的 onTransitionEnd 处理函数通过检查 isScroll.current 状态来条件性调用 stopMomentumScroll,这是修复滑动错位问题的核心逻辑。只有在非滚动状态下才停止动量滚动,避免了在用户主动滚动过程中过早停止的问题。


270-270: 事件处理器绑定正确

onTransitionEnd 事件处理器正确绑定到滚轮元素上,完成了修复逻辑的集成。

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@codecov
Copy link

codecov bot commented Jun 26, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.80%. Comparing base (737d9e2) to head (157b518).
Report is 1 commits behind head on feat_v3.x.

Additional details and impacted files
@@            Coverage Diff             @@
##           feat_v3.x    #3278   +/-   ##
==========================================
  Coverage      87.80%   87.80%           
==========================================
  Files            290      290           
  Lines          19101    19101           
  Branches        2940     2940           
==========================================
  Hits           16772    16772           
  Misses          2324     2324           
  Partials           5        5           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xiaoyatong xiaoyatong merged commit 70427e6 into jdf2e:feat_v3.x Jun 26, 2025
8 checks passed
@xiaoyatong xiaoyatong added the wonderful Wonderful solutions label Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3.x Target branch 3.x action:review This PR needs more reviews (less than 2 approvals) size/S wonderful Wonderful solutions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants