Reputation: 58
I tried to add the caption(text on the photo) to this photo-gallery component, but I can't find anywhere how to do that.
Here is npm site https://www.npmjs.com/package/react-photo-gallery
And this is the sandbox of that https://codesandbox.io/s/9yx911wl9y
Upvotes: 2
Views: 1422
Reputation: 2138
It's unfortunately not as easy as it could be to add captions using react-photo-gallery, but it's not insurmountable.
react-photo-gallery supports defining a custom image renderer, and you need to create one of these that knows what to do with captions. I did this today and posted a simple example in this sandbox. Note that I added a caption
to each image in photos.js, defined the custom image renderer in ImageWithCaption.js, and added some styling in styles.css.
Credits:
Upvotes: 2