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

Cards overlap after individual cards render #70

Open
JedKap opened this issue Feb 11, 2020 · 3 comments
Open

Cards overlap after individual cards render #70

JedKap opened this issue Feb 11, 2020 · 3 comments

Comments

@JedKap
Copy link

JedKap commented Feb 11, 2020

I have this problem where the grid renders with a bunch of ReactStrap Cards, and then the bodies of each card finish rendering, and I wind up with overlaps. I see there is a way to monitor images but I need to updateLayout call after all the cards have finished rendering. Is there a way to do this?

Just to try to explain it a little better...

  1. All cards are the same size and the grid renders them in order
  2. Then the cards get their content (a list of items)
  3. The grid doesn't updateLayout so the cards overlap.

Thanks,
JK

@irtiza07
Copy link

I am running into the same issue :( Did you ever manage to fix it?

@JedKap
Copy link
Author

JedKap commented May 22, 2020

There were two things that I did.
My component is a functional component and I'm using hooks.
When updating the contents of the card I used useLayoutEffect instead of useEffect. The reason I used this was because each card generated a different height and I thought maybe that was the problem. That seemed to help.
The second problem I had was when the component that held the react-stack-grid wasn't wide enough for the cards. So I had to shrink the width of the cards when the browser was made narrower.
I hope this helps.
JK

@RT-TL
Copy link

RT-TL commented Jan 18, 2021

@JedKap I am using the useLayoutEffect to trigger the updateLayout function but the content items still overlap. Did you come across any additional insights? At the moment the only thing that really helps is triggering the updateLayout after a generous timeout but this is of course not a very good or usable way to solve the problem.

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

No branches or pull requests

3 participants