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:
Neekey 2017-07-29 16:12:53 +10:00 committed by 偏右
parent d6a0b1bd3e
commit 6eff4bd02a

View File

@ -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;
}