Skip to content

Lightbox close toggler state not properly updating #232

@exitsimulation

Description

@exitsimulation

Hello!

What's the intended behaviour when closing the lightbox? I thought fslightbox would take care about the toggler state on close, however this seems not to be the case? I then tried to flipping the toggle state in the onClose callback, however, this leads to the lightbox opening again immediately and only after a second close the lightbox closes successfully.

What is the best way to implement the closing behaviour properly? Thanks

const [lightboxOpen, setLightboxOpen] = useState(false);

[...]

{image_slider && imagesLightbox && (
          <FsLightbox
            toggler={lightboxOpen}
            sources={imagesLightbox}
            onClose={() => {
              setLightboxOpen(false);
            }}
          />
        )}```

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