-
Notifications
You must be signed in to change notification settings - Fork 23
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Lightbox close toggler state not properly updating #232
Comments
same problem here - The toggler does not update the shutdown state on its own, but only the change. When we try to override this with the onClose event, the component rerender again. |
@banthagroup Any info on what would be the best approach here? Thanks |
I'm running into the same problem as well - any info on how to proceed would be greatly appreciated |
The workaround: In setUpLightboxUpdater (1/c/main-component/updating) replace
with
|
I got it (for all who are as confused as I am). This toggle state is really a toggle and not a "is visible" flag. So, everytime you change the toggler it will open the view. That's why So the solution is not to do anything onClose, but have it like this: const [lightboxToggle, setLightboxToggle] = useState(false);
[...]
const openLightbox = () => {
setLightboxToggle(!lightboxToggle);
}
{image_slider && imagesLightbox && (
<FsLightbox
toggler={lightboxToggle}
sources={imagesLightbox}
//onClose={() => {
// setLightboxOpen(false);
//}}
/>
)} |
Thanks @27leaves it worked.
|
Hello! I have a similar problem, I have implemented exactly what is here and works, but when I try to open the lightbox for the second time, it won't work anymore, because the toggler value does not get updated. Any ideas? Thank you. |
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
The text was updated successfully, but these errors were encountered: