Skip to content

feat(pulltorefresh): v15 #2898

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

Merged
merged 2 commits into from
Dec 30, 2024
Merged

Conversation

oasis-cloud
Copy link
Collaborator

@oasis-cloud oasis-cloud commented Dec 30, 2024

Summary by CodeRabbit

  • 新功能

    • 在下拉刷新组件中引入 Lottie 动画,替换原有的静态图标
    • 优化下拉刷新时的视觉效果,提供更流畅的交互体验
  • 样式调整

    • 修改下拉刷新头部内容的文字颜色
    • 调整下拉刷新组件的默认高度从 50 增加到 80
  • 兼容性

    • 更新多个平台(H5 和 Taro)的下拉刷新组件实现
    • 保持组件核心功能和交互逻辑不变

Copy link

coderabbitai bot commented Dec 30, 2024

概述

演练

此拉取请求主要修改了 PullToRefresh 组件的视觉呈现,将静态 SVG 图标替换为 Lottie 动画。更改涉及多个演示文件和组件实现,包括 H5 和 Taro 平台的版本。同时,还调整了组件的默认头部高度,从 50 增加到 80。这些变更旨在提供更动态和现代的下拉刷新交互体验。

变更

文件路径 变更摘要
src/packages/pulltorefresh/demos/h5/demo1.tsx 添加 Lottie 动画,移除 SVG 图标
src/packages/pulltorefresh/demos/h5/demo2.tsx 引入白色主题 Lottie 动画,更新列表项文本颜色
src/packages/pulltorefresh/demos/taro/demo1.tsx 替换静态图像为 Lottie 动画
src/packages/pulltorefresh/demos/taro/demo3.tsx 使用 Lottie 动画简化渲染逻辑
src/packages/pulltorefresh/pulltorefresh.scss 更改头部内容文本颜色
src/packages/pulltorefresh/pulltorefresh.taro.tsx 调整默认头部高度为 80
src/packages/pulltorefresh/pulltorefresh.tsx 调整默认头部高度为 80

可能相关的 PR

建议标签

size/L

诗歌

🐰 下拉刷新,动画飞舞
Lottie 魔法,轻盈如风
SVG 告别,新生力量
组件跃动,用户欢畅
代码之兔,跳跃精彩!


📜 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 22c8d11 and 35916b2.

📒 Files selected for processing (2)
  • src/packages/pulltorefresh/pulltorefresh.taro.tsx (1 hunks)
  • src/packages/pulltorefresh/pulltorefresh.tsx (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/packages/pulltorefresh/pulltorefresh.tsx
  • src/packages/pulltorefresh/pulltorefresh.taro.tsx

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate unit testing code.
    • @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.

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. (Beta)
  • @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.

@github-actions github-actions bot added the 3.x Target branch 3.x label Dec 30, 2024
Copy link

codecov bot commented Dec 30, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.97%. Comparing base (744bb5b) to head (35916b2).
Report is 6 commits behind head on feat_v3.x.

Additional details and impacted files
@@             Coverage Diff             @@
##           feat_v3.x    #2898    +/-   ##
===========================================
  Coverage      85.97%   85.97%            
===========================================
  Files            273      277     +4     
  Lines          18492    18692   +200     
  Branches        2736     2769    +33     
===========================================
+ Hits           15898    16070   +172     
- Misses          2589     2617    +28     
  Partials           5        5            

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

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (5)
src/packages/pulltorefresh/demos/h5/demo1.tsx (1)

19-19: 为下拉刷新展示 Lottie 动画
renderIcon 中直接使用 Lottie,可减少状态分支逻辑并保持视觉统一。但需要注意动画文件大小与加载性能,确保在移动端仍能快速渲染。

src/packages/pulltorefresh/demos/h5/demo2.tsx (2)

20-20: 使用 whitePull 动画代替原有图标
在下拉刷新时提供更连贯的动画表现,但要注意在网络不佳环境下的加载情况,必要时可添加本地缓存机制。


31-31: 更改文字颜色以配合深色背景
将字体设置为白色后,更易与深色背景区分。请确认与其它 UI 风格保持一致。

src/packages/pulltorefresh/demos/taro/demo3.tsx (1)

26-26: 使用 Lottie 展示拉动刷新动画
将两张图片合并为一段动画可统一用户体验,并减少条件渲染。但需要确保动画在 Taro 环境下正常播放。

src/packages/pulltorefresh/demos/taro/demo1.tsx (1)

30-30: 采用 Lottie 统一替换下拉刷新图标
在多端保持一致的交互动画,可提升用户对拉动书写的理解与视觉感受。确保该段动画文件大小合适,不影响页面加载性能。

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 744bb5b and 22c8d11.

📒 Files selected for processing (7)
  • src/packages/pulltorefresh/demos/h5/demo1.tsx (2 hunks)
  • src/packages/pulltorefresh/demos/h5/demo2.tsx (3 hunks)
  • src/packages/pulltorefresh/demos/taro/demo1.tsx (2 hunks)
  • src/packages/pulltorefresh/demos/taro/demo3.tsx (2 hunks)
  • src/packages/pulltorefresh/pulltorefresh.scss (1 hunks)
  • src/packages/pulltorefresh/pulltorefresh.taro.tsx (1 hunks)
  • src/packages/pulltorefresh/pulltorefresh.tsx (1 hunks)
🔇 Additional comments (9)
src/packages/pulltorefresh/demos/h5/demo1.tsx (1)

2-3: 引入 Lottie 动画库增强界面交互效果
更换静态资源为 Lottie 动画能使下拉刷新动画更具流畅度与吸引力,同时保持与其他 demo 文件一致的实现方式。

src/packages/pulltorefresh/demos/h5/demo2.tsx (1)

2-3: 新增对 Lottie 与 whitePull 资源的引入
与之前 demo 一致,更换为 Lottie 动画可统一交互体验并减少维护繁琐度。

src/packages/pulltorefresh/demos/taro/demo3.tsx (2)

2-3: 导入 Taro 原生组件与 Lottie
与 H5 版本类似,引入 Lottie 可复用同样的动画资源,减少多端维护成本。


6-6: 引入 lightPull 动画资源
通过统一的动画文件路径管理,可以便于后续维护或替换相应动画。

src/packages/pulltorefresh/demos/taro/demo1.tsx (2)

2-3: 集成 Taro 组件与 PullToRefresh、Lottie
将原先的静态图标替换为 Lottie,减少手动管理各种拉动状态图标的复杂度。


6-6: 追加 lightPull 动画文件
确保与其他 demo 中使用的动画文件名称及路径保持一致,避免后续出现维护混乱或不一致的问题。

src/packages/pulltorefresh/pulltorefresh.taro.tsx (1)

42-42: headHeight 从固定数值改为加法表达式后更灵活

本次变更将 headHeight50 更新为 64 + 16,相当于统一使用了 80,让拉动区域更大,有利于增强用户体验。此调整在不同场景下适用性更高。

src/packages/pulltorefresh/pulltorefresh.tsx (1)

46-46: 与 Taro 版本保持一致性

这里同样将 headHeight 从固定写死改为 64 + 16,保证了与 Taro 端的 PullToRefresh 组件的默认值一致,增强了跨端一致性。

src/packages/pulltorefresh/pulltorefresh.scss (1)

12-12: 颜色变量替换以提升可读性

.nut-pulltorefresh-head-content 的文字颜色从 $color-title 改为 $color-text-help,有助于在主题或视觉层次区分上保持一致,也能在暗色/浅色主题之间拥有更灵活的适配。

@@ -43,7 +43,7 @@ const defaultProps = {
completeText: '',
completeDelay: 500,
disabled: false,
headHeight: 50,
headHeight: 64 + 16,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

旁边加个注释

@xiaoyatong xiaoyatong merged commit 5c77dbe into jdf2e:feat_v3.x Dec 30, 2024
7 checks passed
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 size/M
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants