zesik / react-splitter-layout

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

The library doesn't react to changes to props #14

Closed julienw closed 6 years ago

julienw commented 6 years ago

I try to conditionally use the splitter component: in some cases I don't want to display the secondary pane.

To do this, I set secondaryInitialSize to 0. This doesn't work if I set it to 0 and in a subsequent render set it to something else (like 25). For a reason I don't completely get yet, it works in the opposite direction.

zesik commented 6 years ago

Hi, julienw

The secondaryInitialSize prop, as its name suggests, sets the initial size of secondary panel.

For what you would like to accomplish (hiding the secondary panel), you can choose not to render that component. Please see this example for more detail: https://github.com/zesik/react-splitter-layout/blob/3.0.0/example/javascripts/components/TogglableSidebarLayout.jsx

julienw commented 6 years ago

That's what I did. I was just surprised about the behavior, so maybe it should be more documented.

zesik commented 6 years ago

Thanks for the suggestion! I'll consider including that into the document.