Closed naemtl closed 1 year ago
Please review the documentation and minimal setup example. You are not passing the required parameters, so the result is not surprising.
@igordanchenko I apologize, you're correct that I missed some details in the documentation. For example, I didn't realize you still need to pass the photos
prop if you're also passing a renderContainer
prop to PhotoAlbum
. I may have one last question for you but I'll try to figure it out on my own for a little while first.
Actually, both layout
and photos
props are required. Also I'm not sure you want to use custom renderContainer
in this case. I'd suggest you start without custom render functions and work from there.
Hi @igordanchenko, everything works now, thanks again! There is just one issue... When I try to resize the viewport, I get this error:
ERROR
ResizeObserver loop completed with undelivered notifications.
at handleError (http://localhost:3000/static/js/bundle.js:84913:58)
at http://localhost:3000/static/js/bundle.js:84932:7
Refreshing clears the error, but it will be thrown over and over as the screen's viewport is adjusted. Any ideas? I've stashed my changes and it seems like this is only happening when I use the react-photo-album lib.
Here's the code:
import React, { useState } from "react";
import PhotoAlbum from "react-photo-album";
import Lightbox from "yet-another-react-lightbox";
import "yet-another-react-lightbox/styles.css";
import "./LightboxGallery.scss";
const LightboxGallery = ({ photos }) => {
const [index, setIndex] = useState(-1);
return (
<div className="lightbox-gallery">
<div className="lightbox-gallery__photo-album">
<PhotoAlbum
layout="rows"
photos={photos}
padding={0}
spacing={14}
targetRowHeight={300}
onClick={({ index: current }) => setIndex(current)}
/>
</div>
<Lightbox
index={index}
slides={photos}
open={index >= 0}
close={() => setIndex(-1)}
/>
</div>
);
};
export default LightboxGallery;
And the part of the parent component where I pass the photos:
<LightboxGallery
photos={[
{ src: popOneImg, width: 950, height: 650 },
{ src: popTwoImg, width: 950, height: 650 },
{ src: popThreeImg, width: 950, height: 650 },
{ src: popFourImg, width: 950, height: 650 },
{ src: popFiveImg, width: 950, height: 650 },
{ src: popSixImg, width: 950, height: 650 },
{ src: popSevenImg, width: 985, height: 660 },
]}
/>
I remember seeing similar error in either Chrome or Safari long time ago, but it was a non-issue and could be safely ignored. But the fact that you have a stack trace in your error message, makes me suspect you may be using some sort of ResizeObserver polyfill in your project. Please open new discussion and provide minimal reproducible example if you require further assistance.
Describe the bug
Hi, I'm trying to use your PhotoAlbum and Lightbox libs together to create an image gallery with lightbox functionality in my application. After installing your libs, it seems I'm unable to render anything coming from them. This is probably something I'm doing wrong, but I can't figure out what that is. I've also tried copying a simple example from your documentation to see if I can isolate the issue, but the problem persists.
Expected behavior
I expect the code to render. I don't receive any console errors though or anything to help me decipher what is going wrong.
How to reproduce
Here's my code:
The LightboxGallery component which I've made to reuse a couple times in my app:
Screenshots / Logs
No response
Additional context
No response