bokuweb / re-resizable

📏 A resizable component for React.
https://bokuweb.github.io/re-resizable/
MIT License
2.46k stars 220 forks source link

Parent with display: "flex", flexDirection: "column", and resizable element height: "number in percent" #442

Open Bouncue opened 5 years ago

Bouncue commented 5 years ago

Please take a look and help me how to make resize bottom work:

CodeSanbox

158 Can't resize height if it's given in percents

krisfrenette commented 5 years ago

I am seeing the exact same issue. Is there an update on this?

lc-101 commented 5 years ago

I would also be interested in a solution for this issue.

Cwl100 commented 5 years ago

Bump... seeing this issue too

xQsme commented 5 years ago

Simple workaround: Define the component has having a px size then on the components's did mount function set it to a percentage:

componentDidMount() {
    document.getElementById('content').style.height = '30%';
}
...
render() {
    return (
        <Resizable
            className="content"
            id="content"
            onResize={this.onResize}
            defaultSize={{
                height: '300px',
            }}
...
blshort43 commented 4 years ago

Simple workaround: Define the component has having a px size then on the components's did mount function set it to a percentage:

componentDidMount() {
    document.getElementById('content').style.height = '30%';
}
...
render() {
    return (
        <Resizable
            className="content"
            id="content"
            onResize={this.onResize}
            defaultSize={{
                height: '300px',
            }}
...

Thanks xQsme!! Glad I found this. I was messing with the dang thing for hours thinking I was doing something wrong.

bfintal commented 3 years ago

Another workaround is to render a <style> tag with the percentage height in the height style, and show it onResize and remove it onResizeStop

MrKou47 commented 3 years ago

Another workaround is to render a <style> tag with the percentage height in the height style, and show it onResize and remove it onResizeStop

Could you please provide a demonstrate?

aitella commented 3 years ago

seeing this issue too and workaround with componentDidMount is not an option for ma as well as do not use display: flex on a parent.