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
avatar: Solve the problem of text position size #15468
Conversation
Deploy preview for ant-design ready! Built with commit 1262581 |
Codecov Report
@@ Coverage Diff @@
## master #15468 +/- ##
==========================================
- Coverage 94.25% 94.2% -0.06%
==========================================
Files 250 250
Lines 6653 6643 -10
Branches 1946 1942 -4
==========================================
- Hits 6271 6258 -13
- Misses 381 384 +3
Partials 1 1
Continue to review full report at Codecov.
|
2 similar comments
Codecov Report
@@ Coverage Diff @@
## master #15468 +/- ##
==========================================
- Coverage 94.25% 94.2% -0.06%
==========================================
Files 250 250
Lines 6653 6643 -10
Branches 1946 1942 -4
==========================================
- Hits 6271 6258 -13
- Misses 381 384 +3
Partials 1 1
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #15468 +/- ##
==========================================
- Coverage 94.25% 94.2% -0.06%
==========================================
Files 250 250
Lines 6653 6643 -10
Branches 1946 1942 -4
==========================================
- Hits 6271 6258 -13
- Misses 381 384 +3
Partials 1 1
Continue to review full report at Codecov.
|
测试不好写的话可以先把下面几种情况的 gif 图贴上来,不然后面不知道怎样是对的。
|
gif 图都指的从隐藏到显示的切换
@afc163 你看下 ps: 我这个不一定非得合并的,只要这个问题能解决就行。。。😅 |
代码看起来没啥问题,不过测试跑不通总有点担心…… |
现在的改动差不多是让 |
---
order: 4
title:
zh-CN: 隐藏情况下计算字符对齐
en-US: Calculate text style when hiding
debug: true
---
## zh-CN
切换 Avatar 显示的时候,文本样式应该居中并正确调整字体大小。
## en-US
Text inside Avatar should be set a proper font size when toggle it's visibility.
````jsx
import { Avatar, Button } from 'antd';
class App extends React.Component {
state = {
hide: false,
};
toggle = () => {
this.setState({
hide: !this.state.hide,
});
}
render() {
const { hide } = this.state;
return (
<div>
<Button onClick={this.toggle}>Toggle Avatar</Button>
<Avatar size="large" style={{ background: '#7265e6', display: hide ? 'none' : '' }}>
Avatar
</Avatar>
<Avatar size="large" src="invalid" style={{ background: '#00a2ae', display: hide ? 'none' : '' }}>
Invalid src
</Avatar>
</div>
);
}
}
ReactDOM.render(<App />, mountNode); |
是每次都触发了,但是进去 setScale 里面其实也只是判断一下,这个放外面 update 判断也可以, 每次判断 |
First of all, thank you for your contribution! 😄
New feature please send pull request to feature branch, and rest to master branch.
Pull request will be merged after one of collaborators approve.
Please makes sure that these form are filled before submitting your pull request, thank you!
[中文版模板 / Chinese template]
🤔 This is a ...
👻 What's the background?
💡 Solution
📝 Changelog description
English description
这次应该是完全解决了(。。。)
☑️ Self Check before Merge