-
Couldn't load subscription status.
- Fork 2.5k
feat: 数字键盘的 confirmText 支持换行展示 #6957
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
base: master
Are you sure you want to change the base?
Conversation
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. 📝 WalkthroughWalkthrough本次变更在数字键盘示例中增加一个触发项与第二个键盘实例以演示多行确认文案,并在样式中为确认键添加 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor User as 用户
participant List as Demo 列表
participant NK as NumberKeyboard
Note over User,List: 点击示例项以展示相应键盘
User->>List: 点击 "demo7"
List->>NK: 设置 visible = 'demo7'
NK-->>User: 显示数字键盘(确认键文本支持多行)
User->>NK: 输入并点击确认
NK-->>List: 触发确认回调(携带输入)
Note over NK: 确认键文本按 pre-line 保留换行
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
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. Comment |
Summary of ChangesHello @edokeh, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 此拉取请求引入了一项新功能,允许 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
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.
Code Review
此 PR 旨在为 NumberKeyboard 组件的 confirmText 属性添加换行支持。通过为确认按钮添加 white-space: pre-line; 样式,实现方式是正确的。然而,在演示文件中存在一个错误:新添加的 NumberKeyboard 实例使用了不正确的 visible 条件,导致它与现有键盘冲突,并且无法响应正确的触发事件。我已经对此提出了具体的修改建议。
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6957 +/- ##
=======================================
Coverage 92.95% 92.95%
=======================================
Files 337 337
Lines 7354 7354
Branches 1830 1866 +36
=======================================
Hits 6836 6836
Misses 510 510
Partials 8 8 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
src/components/number-keyboard/demos/demo1.tsx(3 hunks)src/components/number-keyboard/number-keyboard.less(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
src/components/number-keyboard/demos/demo1.tsx (2)
src/components/number-keyboard/number-keyboard.tsx (1)
NumberKeyboard(52-278)src/components/number-keyboard/demos/demo2.tsx (1)
visible(5-58)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
- GitHub Check: compressed-size
- GitHub Check: build preview
- GitHub Check: check
- GitHub Check: size
🔇 Additional comments (4)
src/components/number-keyboard/number-keyboard.less (1)
123-123: 变更合理,支持确认按钮多行文案展示。添加
white-space: pre-line可以正确保留换行符,使确认按钮支持多行文本展示。实现方式符合预期。src/components/number-keyboard/demos/demo1.tsx (3)
1-3: 导入语句调整无问题。导入语句的调整不影响功能,代码整洁度良好。
69-71: 新增演示项正常。新增的列表项用于展示确认按钮文案换行功能,符合 PR 目标。
124-124: 注释说明很有帮助。关于 JSX 中字符串字面量换行符处理的注释很实用,能帮助其他开发者避免常见错误。
| onInput={actions.onInput} | ||
| onDelete={actions.onDelete} | ||
| showCloseButton={false} | ||
| confirmText={'先签约\n再转入'} // {'\n'} 可以而 '\n' 不行,后者会被转义为 '\\n' |
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.
confirmText 支持 ReactNode 吧,这样子直接:
confirmText={<div>...</div>}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.
哈哈哈考虑过,不过这样无障碍标签就没法弄了,又要新开 props
从最小变更角度这么改最好,而且我们目前业务需求上也只是想要文案换行,暂无更多复杂样式

Summary by CodeRabbit