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

When switching a class on a parent element no resize happens. #124

Open
The-Code-Monkey opened this issue Jun 6, 2022 · 5 comments
Open

Comments

@The-Code-Monkey
Copy link

Describe the bug
When you switch a class on a parent element using one that changes size.

To Reproduce
Steps to reproduce the behavior:

Make it so that a class gets added that changes the size of a parent element.

Expected behavior
A resize should happen as the parent div is no longer the correct size.

@bici-fed
Copy link

I had the same problem, how did you finally solve it?

@V3RON
Copy link
Contributor

V3RON commented Sep 28, 2022

If you use usePositioner directly you can provide the className prop as a dependency and then all elements will be reorganized when it changes.

As for <Masonry>, there is no way to force that besides using a key prop and causing a full remount. I guess we can expose something like positionerDeps or imperative reference with the .reorganize() function. 🤔

@jaredLunde
Copy link
Owner

Would be ok with an imperative reference. Maybe a name like .reflow() or .recalcuate()

@V3RON
Copy link
Contributor

V3RON commented Oct 3, 2022

@jaredLunde Actually, why don't we use ResizeObserver? It got decent support unless we care about Internet Explorer and Opera Mini.

https://caniuse.com/?search=resizeobserver

@jaredLunde
Copy link
Owner

Honestly I can't remember why. I have a comment about ResizeObserver in the code for this. Using it elsewhere in the library already.

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

4 participants