-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
styleWrapper cannot be changed in 2.0.0.alpha1 #46
Comments
I ran into the same issue. Looking at the documentation in the source code, it seems as if Thanks for all your work, this is a very helpful package. |
2.0.0-alpha passes the dimensions of the parent element as props, as opposed to passing the dimensions of the wrapper div as props. The previous way was causing many issues on here, particularly with flexbox layouts. The hope is that this way is more intuitive, but it is not documented yet (hence alpha) and I want to see how it works for people. The idea is that you style the parent (ancestor) of the react-dimensions div, or create your own div. The idea of the styling This will require CSS / DOM changes (hence breaking v2 change) but I'm interested to get feedback on how it works after changing code? |
Thanks for the quick response! I think I understand what you are trying to accomplish. The problem for me is that |
May I ask how you are using it? I always assumed people were using react-dimensions to style the width and height of its direct children, so I hadn't considered this case. |
Sorry for not being clear. I am indeed using <div>
<div style="overflow: visible; height: 0px; width: 0px;">
<MyWrappedComponent style={{ width: this.props.containerWidth }}>
(...)
</MyWrappedComponent>
</div>
<div><p> This sentence will overlap with the contents of MyWrappedComponent </p> </div>
</div> Is it clearer now what my problem is? |
In this case maybe try putting a wrapper div around react-dimensions? I think v2 might be a bit of an only child, and doesn't like siblings. |
Hello, I was off for a while. I'm using react dimensions to set height of table that is created by another package(material-ui) and it's not direct child. Could you advice me how to change wrapper style in this case? direct child have heigh 100% and width as well. |
Also run into the fixed |
In my use case I am using react-dimensions to programmatically trigger some functionality upon resizing to mobile. The |
Hello,
in my component i just need to calculate height so I change getDimensions to
getDimensions: (element) => { return ['auto' ,element.clientHeight] }.
Afterwards height is calculated correctly, but my element is not visible because its ancestor has width set to 0 and for some reason overflow: visible is not helping.
I changed wrapperStyle from:
var wrapperStyle = {
overflow: 'visible',
height: 0,
width: 0
};
to:
var wrapperStyle = {
height: 'auto',
width: 'auto'
};
and it works nicely afterwards.
Are you planning on adding possibility to change wrapperStyle?
Thanks for great work.
Ferdinand
The text was updated successfully, but these errors were encountered: