-
Notifications
You must be signed in to change notification settings - Fork 269
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
feat(Toast): 鸿蒙 适配 #2299
Conversation
鸿蒙和rn的换行截断demo未适配成功,函数调用demo需要修改一下demo样式,rn弹出样式居中偏下, |
1)鸿蒙和rn的换行不支持,已屏蔽; |
src/packages/toast/demo.taro.tsx
Outdated
<Demo5 /> | ||
</div> | ||
{/* rn和 鸿蒙不支持 break-all */} | ||
{Taro.getEnv() === Taro.ENV_TYPE.HARMONYHYBRID || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
需要合并下 dev- harmony 的代码,环境判断使用 harmonyAndRn() .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
Walkthrough此次更改主要集中在 Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ToastComponent
User->>ToastComponent: 请求显示 Toast 通知
activate ToastComponent
ToastComponent-->>User: 显示通知
deactivate ToastComponent
Suggested labels
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
: 优化文档描述建议更详细地描述单行文本、多行文本和图片支持的具体用法,以便用户更容易理解。
- 包含单行文本、多行文本、支持图片。 + 支持单行文本、多行文本和图片水印的使用。
There was a problem hiding this 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
: 建议增加图标的无障碍支持当前图标实现缺少无障碍支持:
- 需要为图标添加
role="img"
属性- 建议添加
aria-label
属性以支持屏幕阅读器.nut-toast-icon { width: 24px; height: 24px; color: #ffffff; + role: img; + aria-label: "提示图标"; }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
📒 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%)存在显著差异:
- 这种差异可能会导致不一致的用户体验
- 需要明确说明这种差异的必要性
建议:
- 添加注释说明差异的原因
- 考虑是否可以统一处理
10-24
: 需要验证 flex-direction 的更改是否影响布局
将 flex-direction 从 column 改为 row 可能会影响内容的垂直堆叠布局。建议:
- 验证此更改对所有平台上的内容布局是否有影响
- 确保图标和文本的垂直排列不受影响
.nut-toast-overlay-default-taro { | ||
/* #ifdef harmony */ | ||
background-color: rgba(0, 0, 0, 0); | ||
z-index: 1300; | ||
/* #endif */ | ||
/* #ifndef harmony */ | ||
/* #endif */ | ||
} |
There was a problem hiding this comment.
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)
),这可能会:
- 降低 Toast 内容的可见性
- 影响用户体验,特别是在复杂背景上
建议添加适当的背景透明度,如 rgba(0, 0, 0, 0.1)
。
🤔 这个变动的性质是?
🔗 相关 Issue
💡 需求背景和解决方案
☑️ 请求合并前的自查清单
Summary by CodeRabbit
新功能
Toast
组件的版本,从2.0.0
升级到3.0.0
,可能带来了功能上的增强或修改。样式
.nut-toast
组件的样式,增强了响应性和适应性,支持不同平台。测试
Toast
组件的测试用例,以反映新的类名和样式变化。