We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
No integrated support for closing the viewer when clicking on the overlay.
import { forwardRef, memo, useEffect, useRef, useState } from "react" import Viewer from "react-viewer" import ViewerProps from "react-viewer/lib/ViewerProps" export const ImageViewer = memo(function ImageViewer(props: ViewerProps) { useEffect(() => { if(props.visible) { const handleDocumentClick = (element: PointerEvent) => { if((element.target as HTMLElement).parentElement.classList.contains("react-viewer")) { props.onClose() } } document.addEventListener('click', handleDocumentClick) return () => { document.removeEventListener('click', handleDocumentClick) } } }, [props.visible]) return <Viewer {...props} /> })
The text was updated successfully, but these errors were encountered:
use onMaskClick prop
Sorry, something went wrong.
No branches or pull requests
No integrated support for closing the viewer when clicking on the overlay.
Temporary fix proposal using an wrapper (In an ImageViewer.tsx file for example):
The text was updated successfully, but these errors were encountered: