react-spring-lightbox icon indicating copy to clipboard operation
react-spring-lightbox copied to clipboard

Left Right Buttons not working

Open Hsay28 opened this issue 3 years ago • 2 comments

Here is my code

const [currentImageIndex, setCurrentIndex] = useState(0);

const gotoPrevious = () => currentImageIndex > 0 && setCurrentIndex(currentImageIndex - 1);

const gotoNext = (GalleryImages: any) => { console.log(currentImageIndex); currentImageIndex + 1 < GalleryImages.length && setCurrentIndex(currentImageIndex + 1); };

<Lightbox isOpen={true} className="bg-black/70" onClose={() => setIsLightboxView(false)} onNext={() => gotoNext(GalleryImages)} onPrev={gotoPrevious} singleClickToZoom images={GalleryImages.map((photo: any) => ({ src: photo.src, alt: photo.alt, }))} currentIndex={currentImageIndex} renderPrevButton={() => ( <IoIosArrowBack className={text-5xl text-primary absolute left-20 cursor-pointer} /> )} renderNextButton={() => ( <IoIosArrowForward className={text-5xl text-primary absolute right-20 cursor-pointer} />

Hsay28 avatar Oct 28 '22 13:10 Hsay28

could you make a codesandbox?

tim-soft avatar Oct 28 '22 14:10 tim-soft

I really liked the lib, very easy to apply everything. So I will answer you because I went through the same problem, although I believe that by the time you must have already changed the lib or done something without the aid of a lib. The fact is that the z-index of the image is on the button, so you can not apply, check your css if you still use the lib that should already solve. Applying a z-index of 2 on the buttons worked for me. I hope I have helped and if other people go through the problem can consult this issue

paulopgss avatar Jul 26 '23 16:07 paulopgss