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,17 +41,19 @@ export default class Card extends Component<CardProps> {
|
||||
}
|
||||
@throttleByAnimationFrameDecorator()
|
||||
updateWiderPadding() {
|
||||
// 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) {
|
||||
this.setState({ widerPadding: true }, () => {
|
||||
this.updateWiderPaddingCalled = true; // first render without css transition
|
||||
});
|
||||
}
|
||||
if (this.container.offsetWidth < WIDTH_BOUDARY_PX && this.state.widerPadding) {
|
||||
this.setState({ widerPadding: false }, () => {
|
||||
this.updateWiderPaddingCalled = true; // first render without css transition
|
||||
});
|
||||
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) {
|
||||
this.setState({ widerPadding: true }, () => {
|
||||
this.updateWiderPaddingCalled = true; // first render without css transition
|
||||
});
|
||||
}
|
||||
if (this.container.offsetWidth < WIDTH_BOUDARY_PX && this.state.widerPadding) {
|
||||
this.setState({ widerPadding: false }, () => {
|
||||
this.updateWiderPaddingCalled = true; // first render without css transition
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
saveRef = (node: HTMLDivElement) => {
|
||||
|
Loading…
Reference in New Issue
Block a user