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(safearea): harmony适配 #2745

Merged
merged 2 commits into from
Nov 14, 2024
Merged

fix(safearea): harmony适配 #2745

merged 2 commits into from
Nov 14, 2024

Conversation

irisSong
Copy link
Collaborator

@irisSong irisSong commented Nov 13, 2024

🤔 这个变动的性质是?

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

🔗 相关 Issue

💡 需求背景和解决方案

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

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

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

Summary by CodeRabbit

  • 新功能

    • 更新了多个组件的版本,包括 SafeAreaInputSearchBar 等,提升了组件的性能和稳定性。
    • Demo1 组件的布局改为可滚动的 ScrollView,改善了用户体验。
  • 样式

    • 修改了 .nut-safe-area 类的显示属性为 flex,优化了元素的布局方式。

Copy link

coderabbitai bot commented Nov 13, 2024

Walkthrough

此次更改主要涉及 src/config.json 文件的版本更新,多个组件的版本从 2.0.0 更新至 3.0.0,包括 SafeAreaInputInputNumberRangeSearchBarSwitchTextAreaVideoTrendArrow。同时,部分组件的 show 属性被修改为 false,表示这些组件在用户界面中不再显示。此外,src/packages/safearea/demos/taro/demo1.tsx 文件中的 Demo1 组件布局结构由 View 更改为 ScrollView,而 safearea.harmony.csssafearea.scss 文件中的 .nut-safe-area 类的显示属性由 block 更改为 flex

Changes

文件路径 更改摘要
src/config.json 更新多个组件的版本从 2.0.03.0.0,并修改部分组件的 show 属性为 false
src/packages/safearea/demos/taro/demo1.tsx Demo1 组件的布局从 View 更改为 ScrollView,保持 Text 组件不变。
src/packages/safearea/safearea.harmony.css 修改 .nut-safe-area 类的显示属性从 blockflex,宽度保持为 100%。
src/packages/safearea/safearea.scss 修改 .nut-safe-area 类的显示属性从 blockflex,宽度保持为 100%。

Possibly related PRs

Suggested labels

size/M, 3.x

Suggested reviewers

  • oasis-cloud

兔子在草地上跳跃,
组件更新真是妙,
版本提升乐逍遥,
滚动视图新风貌。
CSS 变得更灵活,
兔子欢呼真不错! 🐇✨


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 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 label Nov 13, 2024
Copy link

codecov bot commented Nov 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.99%. Comparing base (5efd427) to head (54f2c9b).
Report is 9 commits behind head on V3.0.

Additional details and impacted files
@@           Coverage Diff           @@
##             V3.0    #2745   +/-   ##
=======================================
  Coverage   83.98%   83.99%           
=======================================
  Files         221      221           
  Lines       17867    17878   +11     
  Branches     2676     2676           
=======================================
+ Hits        15005    15016   +11     
  Misses       2857     2857           
  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

🧹 Outside diff range and nitpick comments (2)
src/packages/safearea/safearea.scss (1)

Line range hint 1-15: 建议更新文档以反映新的布局行为

由于组件版本升级到 3.0.0 且布局行为发生变化,建议:

  1. 在文档中说明从 blockflex 的变更原因
  2. 提供新的布局行为下的最佳实践示例
  3. 如有必要,提供从 2.0.0 迁移到 3.0.0 的指南

需要我协助编写文档更新内容吗?

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

22-25: 建议优化 ScrollView 的配置

当前的 ScrollView 实现缺少一些重要的属性配置,建议添加以下属性以提升用户体验:

  • scrollY:启用垂直滚动
  • style:设置固定高度
  • enhanced:开启增强性能模式

建议按照以下方式修改代码:

-    <ScrollView>
+    <ScrollView
+      scrollY
+      enhanced
+      style={{ height: '100vh' }}
+    >
       <Text>{generateRandomTextArray(900).join(' ')}</Text>
       <SafeArea position="bottom" />
     </ScrollView>
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 304fd2f and 54f2c9b.

📒 Files selected for processing (4)
  • src/config.json (1 hunks)
  • src/packages/safearea/demos/taro/demo1.tsx (2 hunks)
  • src/packages/safearea/safearea.harmony.css (1 hunks)
  • src/packages/safearea/safearea.scss (1 hunks)
🔇 Additional comments (7)
src/packages/safearea/safearea.harmony.css (2)

Line range hint 5-10: 安全区域计算方式符合规范

顶部和底部安全区域的 padding 计算方式使用 env() 函数正确引用了系统安全区域变量,这符合移动端适配的最佳实践。


1-4: 布局方式更改为 flex 布局

.nut-safe-area 的显示属性从 block 更改为 flex 是一个合理的改进,这样可以更好地控制子元素的布局。保留 width: 100% 确保了组件仍然能够占据完整宽度。

运行以下脚本来验证此更改对现有布局的影响:

✅ Verification successful

布局更改已验证,无影响

此次将 .nut-safe-areadisplay 属性从 block 改为 flex 不会影响现有布局,且提升了布局的灵活性。

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:检查是否有依赖于 block 显示特性的样式

# 搜索可能受影响的相关样式
rg -g '*.{css,scss,less}' 'nut-safe-area'

# 搜索可能的嵌套组件用法
ast-grep --pattern 'SafeArea'

Length of output: 2393

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

2-2: 请验证布局行为的变更影响

将显示属性从 block 更改为 flex 可能会影响现有布局。建议:

  1. 确保此更改与 ScrollView 的实现相兼容
  2. 验证现有使用场景下的布局表现是否符合预期
src/packages/safearea/demos/taro/demo1.tsx (1)

2-2: 导入声明更改正确!

View 更改为 ScrollView 的导入声明与组件使用保持一致。

src/config.json (3)

Line range hint 1-1000: 建议更新版本变更文档

多个组件已升级到 3.0.0 版本,包括:

  • SafeArea
  • Input
  • InputNumber
  • Range
  • SearchBar
  • Switch
  • TextArea
  • Video
  • TrendArrow

建议在 CHANGELOG 或升级指南中详细说明这些变更。

#!/bin/bash
# 描述:检查是否已更新版本变更文档

# 检查 CHANGELOG
fd -g "CHANGELOG.md" | xargs rg "3\.0\.0"

# 检查升级指南
fd -g "*upgrade*.md" | xargs rg "3\.0\.0"

Line range hint 1-1000: 确认组件间的依赖关系

由于多个组件同时升级到 3.0.0 版本,需要确保:

  1. 组件之间的依赖关系正确
  2. 所有相关的子组件版本一致
#!/bin/bash
# 描述:检查组件依赖关系

# 搜索组件间的导入关系
for component in SafeArea Input InputNumber Range SearchBar Switch TextArea Video TrendArrow; do
  echo "Checking dependencies for $component:"
  rg "import.*$component|from.*$component" --type ts --type tsx
done

Line range hint 238-248: 请确认 SafeArea 组件的版本升级影响

SafeArea 组件升级到 3.0.0 版本,这是一个重大版本更新。建议:

  1. 确保更新了相关文档
  2. 验证与其他组件的兼容性
✅ Verification successful

确认 SafeArea 组件版本升级无误

  • SafeArea 组件的版本已升级到 3.0.0。
  • 相关依赖文件和多语言文档均已更新。
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# 描述:检查是否有其他组件依赖 SafeArea 组件

# 搜索代码中对 SafeArea 的引用
rg -l "import.*SafeArea|from.*SafeArea" 

# 检查文档更新
fd -g "*.md" | xargs rg "SafeArea"

Length of output: 2355


Script:

#!/bin/bash
# 描述:检查是否有其他组件依赖 SafeArea 组件并验证文档更新

# 搜索代码中对 SafeArea 的引用
rg -l "import.*SafeArea|from.*SafeArea" -g "*.ts" -g "*.tsx"

# 检查文档中是否提及 SafeArea 组件
fd -g "*.md" | xargs rg "SafeArea"

Length of output: 1180

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

Successfully merging this pull request may close these issues.

2 participants