Skip to content

Left Right Buttons not working #54

Description

@Hsay28

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}
/>

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions