Skip to content
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

Problem: Close button "X" is faded even after passing an onClose prop #4

Open
usman64 opened this issue Sep 28, 2020 · 5 comments
Open

Comments

@usman64
Copy link

usman64 commented Sep 28, 2020

lightbox-issue

Code:
{isImageViewerOpen && (
<Lightbox
images={images}
startIndex={imageIndex}
onClose={() => setIsImageViewerOpen(false)}
/>
)}

@theanam
Copy link
Owner

theanam commented Oct 2, 2020

the close button doesn't have any disable state. Does it close the lightbox when clicked? or functionality is also affected?

@usman64
Copy link
Author

usman64 commented Oct 2, 2020 via email

@usman64
Copy link
Author

usman64 commented Oct 2, 2020 via email

@tlhbyrz
Copy link

tlhbyrz commented Jan 12, 2021

OnClose function triggers funtionality. In order to use Lightbox you should write something like that:

{ postDetail.image && <> <p> <img src={imageSrc} onClick={toggleLightbox} /> </p> { light && <Lightbox image={imageSrc} title="Image Title" onClose={toggleLightbox} /> } </> }

in toggleLightbox function you should toggle light state.

@anisharya16
Copy link

OnClose function triggers funtionality. In order to use Lightbox you should write something like that:

{ postDetail.image && <> <p> <img src={imageSrc} onClick={toggleLightbox} /> </p> { light && <Lightbox image={imageSrc} title="Image Title" onClose={toggleLightbox} /> } </> }

in toggleLightbox function you should toggle light state.

For me, Close button was not working for me and in console i found the error that onClose was not implemented and this answer gave me an idea to implement this. Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants