mirror of
https://github.com/ant-design/ant-design.git
synced 2024-11-28 05:05:48 +08:00
check this.container exists updating WiderPadding (#6976)
before doing updating wider padding for Card, always check if the container exists first.
This commit is contained in:
parent
d6a0b1bd3e
commit
6eff4bd02a
@ -41,6 +41,7 @@ export default class Card extends Component<CardProps> {
|
||||
}
|
||||
@throttleByAnimationFrameDecorator()
|
||||
updateWiderPadding() {
|
||||
if (this.container) {
|
||||
// 936 is a magic card width pixer number indicated by designer
|
||||
const WIDTH_BOUDARY_PX = 936;
|
||||
if (this.container.offsetWidth >= WIDTH_BOUDARY_PX && !this.state.widerPadding) {
|
||||
@ -54,6 +55,7 @@ export default class Card extends Component<CardProps> {
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
saveRef = (node: HTMLDivElement) => {
|
||||
this.container = node;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user