Open gaven opened 6 years ago
Did you fix this?
@JonesDM No, I did not. I ended up using CSS columns instead. Have you found a solution?
this.masonry is a reference to a Masonry instance.
does this.masonry.layout()
or this.masonry.reloadItems()
work for you?
https://masonry.desandro.com/methods.html#layout-masonry
https://masonry.desandro.com/methods.html#reloaditems
@afram No, neither of these methods worked for me. For my use case I had a card
that grew when you clicked read more. After it was done growing I needed to reload the masonry instance due to the fact that card had nestled itself behind the rest of the masonry items.
@afram the this.masonry
instance doesn't have those methods at all. I'm facing the same issue as well.
@tallpants that's really strange. this.masonry
should be a reference to a Masonry instance. Are you able to reproduce with an example on webpackbin please?
@afram my bad, I was trying to call it before the ref was assigned. this.masonry.layout()
works, although it would probably be a good idea to put that in the docs. I don't mind making a PR with an updated README if that's okay with you.
sure that would be great @tallpants :-)
If I dynamically change the size of an item will calling this.masonry.layout() cause the items to reorder accordingly to fit? Because when calling it, the items still stay the same and arent being reordered.
If I dynamically change the size of an item will calling this.masonry.layout() cause the items to reorder accordingly to fit? Because when calling it, the items still stay the same and arent being reordered.
On a project I'm working on I need the ability to force update the layout on a click event. Is there a method on
this.masonry
that allows this? I have cards that expand and collapse on click.
Realise this is a long time after you were working on this, but found this functionality is already built in.
Looking through the Index.js file of the module there is a prop you can add to the masonry component "enableResizableChildren".
Your Masonry component would looks something like:
`<Masonry enableResizableChildren={true} otherProps=""
// Your masonry content `
Could someone provide an example of calling reloadItems
from within a function component?
On a project I'm working on I need the ability to force update the layout on a click event. Is there a method on
this.masonry
that allows this? I have cards that expand and collapse on click.