Giter VIP home page Giter VIP logo

Comments (10)

erkartik91 avatar erkartik91 commented on July 20, 2024 10

I added reference to my Masonry instance using the following code
ref={function(c) {this.masonry = c.masonry;}.bind(this)}

and now can manually trigger resize using the following code
this.masonry.layout()

Hope this helps.

from react-masonry-component.

afram avatar afram commented on July 20, 2024 3

fixed in [email protected]

from react-masonry-component.

eiriklv avatar eiriklv commented on July 20, 2024 2

If anyone has a solution that keeps the existing functionality and fixes this then feel free to send a PR! This component is a bit hacky from the start actually, so a hacky solution that is encapsulated in the Masonry component (not leaking out) is better than no solution :-)

from react-masonry-component.

ldsmike88 avatar ldsmike88 commented on July 20, 2024 2

If anyone is still trying to figure this out, the new way to do this is:

<Masonry enableResizableChildren>{ children }</Masonry>

#116 (comment)

from react-masonry-component.

AugustinLF avatar AugustinLF commented on July 20, 2024

I had the same problem. As far as I can see, the only way is to change a props of Masonry (any, even if it doesn't exist), to force a reload (the component triggers a reloadItems on ComponentWillReceiveProps. Not perfect, but this is the same thing (IIRC) with Masonry in general (not about this component), even with vanilla JS, you still need to trigger the refresh.

from react-masonry-component.

aaronhayes avatar aaronhayes commented on July 20, 2024

so my very hacky solution was to expose the performLayout function of React-Masonry and call it whenever I needed a refresh. It works but not very elegant.

from react-masonry-component.

t1mmen avatar t1mmen commented on July 20, 2024

I managed to work around this by simply setting state in the component that has <Masonry /> in it's render method (didn't need to pass the state as prop, even)

from react-masonry-component.

RafaelVidaurre avatar RafaelVidaurre commented on July 20, 2024

@t1mmen's approach works, though this is clearly still a hacky approach.

from react-masonry-component.

ankur0890 avatar ankur0890 commented on July 20, 2024

Facing the same issue. Unable to figure out a solution yet. Put this on stackoverflow also for more ideas http://stackoverflow.com/questions/34411211/reload-react-masonry-component-manually

from react-masonry-component.

maurusrv avatar maurusrv commented on July 20, 2024

hi, also encountered this issue and i used @erkartik91's solution and it worked.

anyway,
i am using this library: https://github.com/puikinsh/Adminator-admin-dashboard which uses react-masonry-component too as i've looked into my node_modules folder. according to the changelog, it's version is 6.2.0.

last comment here says it's fixed even in the earlier version (4.3.0), but i wonder is it really fixed in the update? because i still encountered this same issue.

thank you.

from react-masonry-component.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.