#22: Fix height jumps in Collapsed

This commit is contained in:
SleepWalker 2019-01-14 21:43:52 +02:00
parent e2e43e6e8f
commit 08cf6d38b8

View File

@ -34,12 +34,11 @@ export default class Collapse extends Component<Props, {
} }
render() { render() {
// TODO: @SleepWalker сейчас при первой отрисовке можно увидеть дёргание родительского блока. Надо пофиксить.
const { isOpened, children, onRest } = this.props; const { isOpened, children, onRest } = this.props;
const { height, wasInitialized } = this.state; const { height, wasInitialized } = this.state;
return ( return (
<div className={styles.overflow}> <div className={styles.overflow} style={wasInitialized ? {} : { height: 0 }}>
<MeasureHeight <MeasureHeight
state={this.shouldMeasureHeight()} state={this.shouldMeasureHeight()}
onMeasure={this.onUpdateHeight} onMeasure={this.onUpdateHeight}
@ -56,7 +55,6 @@ export default class Collapse extends Component<Props, {
style={{ style={{
marginTop: top, marginTop: top,
visibility: wasInitialized ? 'inherit' : 'hidden', visibility: wasInitialized ? 'inherit' : 'hidden',
// height: wasInitialized ? 'auto' : 0,
}} }}
> >
{children} {children}