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: configurable toast #911

Merged
merged 7 commits into from
Jun 7, 2020

Conversation

helsonxiao
Copy link
Contributor

@helsonxiao helsonxiao commented Jun 7, 2020

First of all, thank you for your contribution! :-)

Please makes sure that these checkboxes are checked before submitting your PR, thank you!

  • Make sure that you follow antd's code convention.
  • Run npm run lint and fix those errors before submitting in order to keep consistent code style.
  • Rebase before creating a PR to keep commit history clear.
  • Add some descriptions and refer relative issues for you PR.

Extra checklist:

if isBugFix :

  • Make sure that you add at least one unit test for the bug which you had fixed.

elif isNewFeature :

  • Update API docs for the component.
  • Update/Add demo to demonstrate new feature.
  • Update TypeScript definition for the component.
  • Add unit tests for the feature.

新增功能

#899

  • defaultConfig,Toast 默认参数
  • config 方法,用于自定义 Toast 的默认参数,建议在 App 启动后调用
  • getConfig 方法,用于获取当前配置
  • content 参数支持传入对象,向后兼容的同时,支持新的参数
    • stackable: 开启时,这条 Toast 会叠加在之前的 Toast 上;关闭时,弹出这条 Toast 前会清空其它 Toast。默认开启,建议开发者在生产环境下关闭,保证更好的用户体验。
  • remove 方法,同 Portal.remove,对外隐藏 Portal 概念
  • removeAll 方法,清空当前所有 Toast

Bug Fix

  • 修复文档中“一次只允许一个 Toast”这个不正确的描述
  • 将文档中未提及的 show API 标记为 deprecated
  • 修复文档中对于 hide 的相关描述
  • 修复文档中 duration 默认值是 3s,但代码中是 2s 的问题
  • Switch 使用 trackColor,消除 RN 的警告⚠️

onTintColor={color}
trackColor={{
true: color,
false: '',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

在安卓上测试通过,维持默认颜色

Copy link
Member

Choose a reason for hiding this comment

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

晚上我看看

@codecov
Copy link

codecov bot commented Jun 7, 2020

Codecov Report

Merging #911 into master will decrease coverage by 0.24%.
The diff coverage is 15.68%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #911      +/-   ##
==========================================
- Coverage   61.55%   61.31%   -0.25%     
==========================================
  Files         212      212              
  Lines        5002     5033      +31     
  Branches     1077     1080       +3     
==========================================
+ Hits         3079     3086       +7     
- Misses       1906     1930      +24     
  Partials       17       17              
Flag Coverage Δ
#rn 61.31% <15.68%> (-0.25%) ⬇️
Impacted Files Coverage Δ
components/switch/index.tsx 100.00% <ø> (ø)
components/toast/demo/basic.tsx 25.00% <10.52%> (-4.04%) ⬇️
components/toast/index.tsx 23.25% <18.75%> (+4.20%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 69e4466...a6e81ca. Read the comment docs.

@helsonxiao helsonxiao changed the title WIP - feat: configurable toast feat: configurable toast Jun 7, 2020
@helsonxiao helsonxiao marked this pull request as ready for review June 7, 2020 09:41
@helsonxiao helsonxiao mentioned this pull request Jun 7, 2020
1 task
* @deprecated @param duration
* @deprecated @param onClose
* @deprecated @param mask
*/
Copy link
Member

Choose a reason for hiding this comment

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

这些 deprecated 加不加都行,旧的代码是改不了了。 不过加上也好,只是以后也不会说真的干掉只保留对象的方式.

😄

代码还是写的很棒的,谢谢。

Copy link
Contributor Author

Choose a reason for hiding this comment

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

客气了,这阵子可能还会根据业务需要提一些 issue / pr 😁

Copy link
Member

Choose a reason for hiding this comment

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

如果是急需的就尽快了,要准备发新版了。

@BANG88 BANG88 merged commit 3bf7f5d into ant-design:master Jun 7, 2020
@helsonxiao helsonxiao deleted the helson/configurable-toast branch July 5, 2020 08:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants