cedricdelpoux / react-responsive-masonry

React responsive masonry component built with css flexbox
https://cedricdelpoux.github.io/react-responsive-masonry/
MIT License
353 stars 35 forks source link

issue with container of item is width:0px #108

Open STU-DESIGNER opened 1 year ago

STU-DESIGNER commented 1 year ago

display: flex;flex-direction: column;place-content: stretch flex-start;flex: 1 1 0%;/ width: 0px; /gap: 10px;

Removing width 0px; Fixed my issue. had to remove the width to fix this


useEffect(()=>{
        const data = document.querySelectorAll('div[style="display: flex; flex-direction: column; place-content: stretch flex-start; flex: 1 1 0%; width: 0px; gap: 10px;"');
        console.log(data)
        if(data){
            data.forEach((item)=>{
                (item as HTMLElement).setAttribute('style', 'display: flex; flex-direction: column; place-content: stretch flex-start; flex: 1 1 0%; width: 100%; gap: 10px;')
            })
        }
    },[document.querySelectorAll('div[style="display: flex; flex-direction: column; place-content: stretch flex-start; flex: 1 1 0%; width: 0px; gap: 10px;"')])
AlexEnache98 commented 1 year ago

Hey @STU-DESIGNER While your solution does the job at first sight it doesn't work for safari because the selector becomes a bit different, A solution that i found for all browsers is to .post__responsive > div > div { width: 100% !important; }

where the post__responsive in my case is the className applied on the ResponsiveMasonry component.