zesik / react-splitter-layout

A simple split layout for React and modern browsers. https://zesik.com/react-splitter-layout
MIT License
428 stars 131 forks source link

Allow resizing areas from code, without unmounting. #57

Open joe-oli opened 4 years ago

joe-oli commented 4 years ago

FEATURE REQUEST: Currently panel areas (what you call layout-pane) cannot be resized using code, one must actually drag the separators on the UI.

For example, I expected forcing a re-render for the component to re-adjust initial size.

<SplitterLayout vertical percentage={true} secondaryInitialSize={this.state.bottomPanelSizePct} secondaryMinSize={8} primaryMinSize={4} >
    <div className="editor">
        Top Panel
    </div>
    <div className="editor">
        Bottom Panel
    </div>
</SplitterLayout>

It appears one must actually unmount the component, then mount it again, with a new secondaryInitialSize, for the size re-adjustment to be possible from code.

It should be possible to just re-render the component, and change the sizes without Unmounting?