benhowell / react-grid-gallery

Justified image gallery component for React
https://benhowell.github.io/react-grid-gallery/
MIT License
996 stars 206 forks source link

Gallery shows nothing in a modal. #366

Open Vin-dellavv opened 4 months ago

Vin-dellavv commented 4 months ago

Expected behaviour

Being able to utilize the gallery in a modal (like zendesk garden one).

Actual behaviour

Only in the modal the Gallery component does not show any images. I suspect in line 46 thumbnails is an empty array so thumbnails.map returns nothing because buildLayoutFlat -> buildLayout exits early on line 95.

Steps to reproduce behaviour

Here's a sandbox to reproduce it

Browser and version

Browsers: all, Version: "react-grid-gallery": "^1.0.1"

marulka commented 3 months ago

Try to add some width to the container using CSS, or set drfaultContainerWidth prop to some value. Note: This is a workaround. The defaultContainerWidth should be set to some adequate minimum positive value, rather than 0.