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

feat(Toast): 鸿蒙 适配 #2299

Merged
merged 20 commits into from
Nov 7, 2024
Merged

feat(Toast): 鸿蒙 适配 #2299

merged 20 commits into from
Nov 7, 2024

Conversation

xiaoyatong
Copy link
Collaborator

@xiaoyatong xiaoyatong commented May 29, 2024

🤔 这个变动的性质是?

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

🔗 相关 Issue

💡 需求背景和解决方案

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

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

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

Summary by CodeRabbit

  • 新功能

    • 更新了 Toast 组件的版本,从 2.0.0 升级到 3.0.0,可能带来了功能上的增强或修改。
  • 样式

    • 改进了 .nut-toast 组件的样式,增强了响应性和适应性,支持不同平台。
    • 统一了字体大小变量的命名规范,提升了样式管理的一致性。
  • 测试

    • 更新了 Toast 组件的测试用例,以反映新的类名和样式变化。

@xiaoyatong xiaoyatong changed the title feat: Toast RN 适配 feat: Toast RN & 鸿蒙 适配 May 30, 2024
@xiaoyatong xiaoyatong requested a review from irisSong May 31, 2024 03:25
@irisSong
Copy link
Collaborator

irisSong commented May 31, 2024

鸿蒙和rn的换行截断demo未适配成功,函数调用demo需要修改一下demo样式,rn弹出样式居中偏下,

@xiaoyatong
Copy link
Collaborator Author

鸿蒙和rn的换行截断demo未适配成功,函数调用demo需要修改一下demo样式,rn弹出样式居中偏下,

1)鸿蒙和rn的换行不支持,已屏蔽;
2)函数调用demo已修改;
3)rn弹出样式居中修改已处理。

@oasis-cloud
Copy link
Collaborator

RN 下的展示换行了
image

@oasis-cloud
Copy link
Collaborator

鸿蒙下太宽了
image

<Demo5 />
</div>
{/* rn和 鸿蒙不支持 break-all */}
{Taro.getEnv() === Taro.ENV_TYPE.HARMONYHYBRID ||
Copy link
Collaborator

Choose a reason for hiding this comment

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

需要合并下 dev- harmony 的代码,环境判断使用 harmonyAndRn() .

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fixed

Copy link

coderabbitai bot commented Jul 24, 2024

Walkthrough

此次更改主要集中在 src/config.json 文件的版本更新,特别是将 Toast 组件的版本从 2.0.0 更新至 3.0.0。该更改表明组件功能或特性的潜在增强或修改,但具体的行为或实现细节未在差异中提供。JSON 的整体结构保持不变,组件的可见性设置也未发生变化。同时,CSS 和 SCSS 文件中的样式也进行了相应的调整,以支持不同平台的适配。

Changes

文件路径 更改摘要
src/config.json Toast 组件的版本从 2.0.0 更新至 3.0.0
src/packages/overlay/overlay.harmony.css .nut-overlay 类引入条件 CSS 规则,基于 rn 预处理指令设置 position 属性。移除 .nut-overflow-hidden .taro_page 规则。
src/packages/toast/toast.scss 根据平台(React Native 与非 React Native)调整 .nut-toast 类的样式,添加新的大小类,增强响应式设计。
src/styles/variables-jrkf.scss 更新多个字体大小变量的命名,确保一致性,调整多个组件中的字体大小引用。
src/packages/toast/__test__/toast.spec.tsx 更新 Toast 组件的测试用例,调整类名的断言以反映新的类名。
src/packages/toast/demos/taro/demo1.tsx 简化 Cell 组件的 title 属性文本,更新成功 Toast 的内容。
src/packages/toast/toast.taro.tsx 更新 Toast 组件的导入语句和接口结构,简化逻辑,增强与 Taro 框架的兼容性。
src/packages/toast/toast.harmony.css .nut-toast 类添加条件样式,调整其 position 属性,重命名多个类以提高一致性,增强 RTL 支持。
package.json 更新依赖 @nutui/icons-react-taro 的版本从 ^1.0.52.0.0-beta.0

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant ToastComponent

    User->>ToastComponent: 请求显示 Toast 通知
    activate ToastComponent
    ToastComponent-->>User: 显示通知
    deactivate ToastComponent
Loading

Suggested labels

size/XXL

Suggested reviewers

  • oasis-cloud
  • irisSong

🐰 在草地上跳跃,欢呼变革来,
版本更新如春风,带来新气象!
Toast 组件焕新颜,功能更强大,
感谢大家的努力,共同筑梦想的未来!


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.

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, codebase verification and nitpick comments (1)
src/packages/watermark/doc.taro.md (1)

15-16: 优化文档描述

建议更详细地描述单行文本、多行文本和图片支持的具体用法,以便用户更容易理解。

- 包含单行文本、多行文本、支持图片。
+ 支持单行文本、多行文本和图片水印的使用。

@xiaoyatong xiaoyatong changed the base branch from dev-harmony to V3.0 November 6, 2024 06:22
@pull-request-size pull-request-size bot removed the size/L label Nov 6, 2024
@xiaoyatong
Copy link
Collaborator Author

image

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: 1

🧹 Outside diff range and nitpick comments (1)
src/packages/toast/toast.harmony.css (1)

94-105: 建议增加图标的无障碍支持

当前图标实现缺少无障碍支持:

  1. 需要为图标添加 role="img" 属性
  2. 建议添加 aria-label 属性以支持屏幕阅读器
.nut-toast-icon {
  width: 24px;
  height: 24px;
  color: #ffffff;
+ role: img;
+ aria-label: "提示图标";
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

📥 Commits

Reviewing files that changed from the base of the PR and between 0febed8 and 03c12f8.

📒 Files selected for processing (3)
  • src/packages/toast/toast.harmony.css (2 hunks)
  • src/packages/toast/toast.scss (5 hunks)
  • src/packages/toast/toast.taro.tsx (8 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • src/packages/toast/toast.scss
  • src/packages/toast/toast.taro.tsx
🔇 Additional comments (2)
src/packages/toast/toast.harmony.css (2)

68-73: 请说明 RN 和其他平台位置差异的原因

React Native 平台上的垂直位置(38%)与其他平台(48%)存在显著差异:

  1. 这种差异可能会导致不一致的用户体验
  2. 需要明确说明这种差异的必要性

建议:

  • 添加注释说明差异的原因
  • 考虑是否可以统一处理

10-24: 需要验证 flex-direction 的更改是否影响布局

将 flex-direction 从 column 改为 row 可能会影响内容的垂直堆叠布局。建议:

  1. 验证此更改对所有平台上的内容布局是否有影响
  2. 确保图标和文本的垂直排列不受影响

Comment on lines +27 to 34
.nut-toast-overlay-default-taro {
/* #ifdef harmony */
background-color: rgba(0, 0, 0, 0);
z-index: 1300;
/* #endif */
/* #ifndef harmony */
/* #endif */
}
Copy link

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion

建议重新考虑鸿蒙平台的背景透明度设置

当前实现在鸿蒙平台上将背景色设置为完全透明(rgba(0, 0, 0, 0)),这可能会:

  1. 降低 Toast 内容的可见性
  2. 影响用户体验,特别是在复杂背景上

建议添加适当的背景透明度,如 rgba(0, 0, 0, 0.1)

@irisSong irisSong merged commit 9160682 into jdf2e:V3.0 Nov 7, 2024
6 checks passed
@xiaoyatong xiaoyatong changed the title feat: Toast RN & 鸿蒙 适配 feat(Toast): 鸿蒙 适配 Nov 8, 2024
This was referenced Dec 3, 2024
This was referenced Dec 25, 2024
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/XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants