Skip to content
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

Best way to re-calculate height? #259

Closed
reintroducing opened this issue Feb 8, 2020 · 3 comments
Closed

Best way to re-calculate height? #259

reintroducing opened this issue Feb 8, 2020 · 3 comments

Comments

@reintroducing
Copy link
Contributor

@reintroducing reintroducing commented Feb 8, 2020

I've got a Panel component that opens/closes with react-collapse. Inside of it I have a Table component that shows, you guessed it, a table. When resizing the browser down to smaller viewports, the table collapses into Card components which are much taller than the table itself originally was. When I resize it, the height obviously becomes larger and breaks layout of the Panel.

Is there a good way to re-render the panel to re-calculate the height based on the resized content? Or is my only choice to manually listen to window resize and re-create the whole panel manually? I hope not, but I'm not sure if there is a way around this right now.

@nkbt

This comment has been minimized.

Copy link
Owner

@nkbt nkbt commented Feb 9, 2020

  1. Short answer probably would be yes - listen to browser resize.
  2. Also check react-element-resize lib
  3. Please create some code sandbox as I can only remotely guess what your case is and have almost no clue what you see
@reintroducing

This comment has been minimized.

Copy link
Contributor Author

@reintroducing reintroducing commented Feb 9, 2020

@nkbt I'm not quite sure what happened yesterday that I was seeing this (I have a feeling it may be my HMR not reloading properly when I filed this) but I am not seeing this issue any longer today. Apologies for the noise, but react-element-resize looks pretty cool so at least I got that out of this :)

@nkbt

This comment has been minimized.

Copy link
Owner

@nkbt nkbt commented Feb 9, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.