eiriklv / react-masonry-component

A React.js component for using @desandro's Masonry
MIT License
1.44k stars 145 forks source link

react-masonry-component doesn't respect masonry's initLayout setting #54

Open jrmyio opened 7 years ago

jrmyio commented 7 years ago

I am trying to handle the call of .layout() myself and looking at masonry's docs one can disable the layout by setting initLayout to false.

However this component doesn't use this option to disable the following lines that trigger layout:

    componentWillReceiveProps: function() {
        this._timer = setTimeout(function() {
            this.masonry.reloadItems();
            this.isMounted && this.isMounted() && this.forceUpdate();
        }.bind(this), 0);
    },

    componentDidUpdate: function() {
        this.performLayout();
        this.imagesLoaded();
    },
afram commented 7 years ago

Yeah that's something that can be added easy enough. Are you comfortable enough to submit the required changes in a backwards compatible way?