1
0
mirror of https://github.com/chinchang/web-maker.git synced 2025-07-31 10:40:10 +02:00

SplitPane: fix retaining both width/height on pane bug

This commit is contained in:
Kushagra Gour
2018-11-30 10:51:11 +05:30
parent 45bf3a0bfb
commit 932bbe43dc

View File

@@ -5,7 +5,11 @@ export class SplitPane extends Component {
componentDidMount() {
this.updateSplit();
}
componentWillUpdate() {
if (this.splitInstance) {
this.splitInstance.destroy();
}
}
componentDidUpdate(prevProps) {
if (this.hasGutter() && !this.hasPropsChanged(prevProps, this.props)) {
return;
@@ -33,13 +37,8 @@ export class SplitPane extends Component {
const { children, ...options } = this.props;
options.gutterSize = 6;
if (this.splitInstance && this.hasGutter()) {
this.splitInstance.destroy();
}
/* eslint-disable new-cap */
this.splitInstance = Split([...this.parent.children], options);
console.log('recreating split');
/* eslint-enable new-cap */