bjgrosse / react-resize-panel

Simple React resize panel component
MIT License
139 stars 55 forks source link

Setting initial panel width #12

Open dylanhusted opened 3 years ago

dylanhusted commented 3 years ago

Looking at the demo, the panel labeled "right panel with custom handle default 400px" doesn't seem to default to 400px, despite style being set that way here: https://github.com/bjgrosse/react-resize-panel/blob/master/demo/src/App.js#L22

In my case it starts at 395px:

Screenshot from 2020-10-27 16-53-23

In my usage of <ResizePanel />, I'm also seeing my initial width set via the style attribute not being respected.

Looking in the source code, the initial width/height is not being grabbed from props.style, so this behavior does make sense: https://github.com/bjgrosse/react-resize-panel/blob/master/src/ResizePanel.js#L25

That makes this library unusable for a case where I need to start with a 50% width, and let the user resize up or down from there.

Is there something I'm missing here?

Thanks for the library, and I could offer some help here if you're unable to patch this.