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: Avatar doesn't scale when display is none #26522

Merged
merged 1 commit into from Sep 2, 2020
Merged

fix: Avatar doesn't scale when display is none #26522

merged 1 commit into from Sep 2, 2020

Conversation

zhangyu1818
Copy link
Contributor

@zhangyu1818 zhangyu1818 commented Sep 1, 2020

[中文版模板 / Chinese template]

🤔 This is a ...

  • New feature
  • Bug fix
  • Site / documentation update
  • Demo update
  • Component style update
  • TypeScript definition update
  • Bundle size optimization
  • Performance optimization
  • Enhancement feature
  • Internationalization
  • Refactoring
  • Code style optimization
  • Test Case
  • Branch merge
  • Other (about what?)

🔗 Related issue link

close #26521

💡 Background and solution

📝 Changelog

Language Changelog
🇺🇸 English Fix Avatar doesn't scale fallback text well when display is none.
🇨🇳 Chinese 修复 Avatar 在 display: none 时不会正确缩放 fallback 文字的问题。

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • TypeScript definition is updated/provided or not needed
  • Changelog is provided or not needed

@ant-design-bot
Copy link
Contributor

ant-design-bot commented Sep 1, 2020

@ant-design-bot
Copy link
Contributor

ant-design-bot commented Sep 1, 2020

@codesandbox-ci
Copy link

codesandbox-ci bot commented Sep 1, 2020

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit f2ec3a0:

Sandbox Source
antd reproduction template Configuration

@codecov
Copy link

codecov bot commented Sep 1, 2020

Codecov Report

Merging #26522 into master will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26522      +/-   ##
==========================================
- Coverage   99.75%   99.75%   -0.01%     
==========================================
  Files         383      383              
  Lines        7351     7343       -8     
  Branches     2048     2053       +5     
==========================================
- Hits         7333     7325       -8     
  Misses         18       18              
Impacted Files Coverage Δ
components/avatar/avatar.tsx 100.00% <100.00%> (ø)

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 71f726a...f2ec3a0. Read the comment docs.

@afc163
Copy link
Member

afc163 commented Sep 1, 2020

来个用例?

if (props.children) {
setScaleParam();
}
}, [isImgExist]);
Copy link
Member

@zombieJ zombieJ Sep 2, 2020

Choose a reason for hiding this comment

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

每次 effect 都算一次太耗费了,包一个 ResizeObserver

Copy link
Contributor Author

Choose a reason for hiding this comment

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

大佬,这里改好了

@zhangyu1818
Copy link
Contributor Author

zhangyu1818 commented Sep 2, 2020

这个测试好像不好写,display:none好像没用,我看见之前偏右大佬专门写了一个调试专用demo来测试这个问题

@afc163 afc163 merged commit e2dda85 into ant-design:master Sep 2, 2020
@pr-triage pr-triage bot added the PR: merged label Sep 2, 2020
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.

Avatar组件在display:none时不会计算缩放
4 participants