mirror of
https://github.com/chinchang/web-maker.git
synced 2025-08-02 11:30:22 +02:00
SplitPane: fix retaining both width/height on pane bug
This commit is contained in:
@@ -5,7 +5,11 @@ export class SplitPane extends Component {
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.updateSplit();
|
this.updateSplit();
|
||||||
}
|
}
|
||||||
|
componentWillUpdate() {
|
||||||
|
if (this.splitInstance) {
|
||||||
|
this.splitInstance.destroy();
|
||||||
|
}
|
||||||
|
}
|
||||||
componentDidUpdate(prevProps) {
|
componentDidUpdate(prevProps) {
|
||||||
if (this.hasGutter() && !this.hasPropsChanged(prevProps, this.props)) {
|
if (this.hasGutter() && !this.hasPropsChanged(prevProps, this.props)) {
|
||||||
return;
|
return;
|
||||||
@@ -33,13 +37,8 @@ export class SplitPane extends Component {
|
|||||||
const { children, ...options } = this.props;
|
const { children, ...options } = this.props;
|
||||||
options.gutterSize = 6;
|
options.gutterSize = 6;
|
||||||
|
|
||||||
if (this.splitInstance && this.hasGutter()) {
|
|
||||||
this.splitInstance.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
/* eslint-disable new-cap */
|
/* eslint-disable new-cap */
|
||||||
this.splitInstance = Split([...this.parent.children], options);
|
this.splitInstance = Split([...this.parent.children], options);
|
||||||
console.log('recreating split');
|
|
||||||
|
|
||||||
/* eslint-enable new-cap */
|
/* eslint-enable new-cap */
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user