@jalik/react-lightbox
Advanced tools
Comparing version 1.0.8 to 1.0.9
# Changelog | ||
## v1.0.9 | ||
- Fixed closing of lightbox | ||
- Upgraded dependencies | ||
## v1.0.8 | ||
@@ -4,0 +9,0 @@ |
@@ -37,3 +37,4 @@ "use strict"; | ||
var _useLightBoxContext = (0, _useLightBoxContext2["default"])(), | ||
dispatch = _useLightBoxContext.dispatch; | ||
dispatch = _useLightBoxContext.dispatch, | ||
show = _useLightBoxContext.show; | ||
@@ -47,3 +48,3 @@ var memoizedPaths = (0, _react.useMemo)(function () { | ||
// Check if clicked element is an image declared in light box wrapper. | ||
if (event.target.nodeName === 'IMG') { | ||
if (!show && event.target.nodeName === 'IMG') { | ||
var activeIndex = memoizedPaths.indexOf(decodeURIComponent(event.target.src)); | ||
@@ -50,0 +51,0 @@ |
{ | ||
"name": "@jalik/react-lightbox", | ||
"version": "1.0.8", | ||
"version": "1.0.9", | ||
"description": "Light box component for React", | ||
@@ -51,3 +51,3 @@ "main": "dist/index.js", | ||
"jest": "^26.6.3", | ||
"react": "^16.14.0", | ||
"react": "^17.0.2", | ||
"rimraf": "^3.0.2", | ||
@@ -54,0 +54,0 @@ "typescript": "^4.2.4" |
/* | ||
* The MIT License (MIT) | ||
* Copyright (c) 2020 Karl STEIN | ||
* Copyright (c) 2021 Karl STEIN | ||
*/ | ||
@@ -18,3 +18,3 @@ | ||
function LightBoxWrapper({ children, items }) { | ||
const { dispatch } = useLightBoxContext(); | ||
const { dispatch, show } = useLightBoxContext(); | ||
const memoizedPaths = useMemo(() => ( | ||
@@ -26,3 +26,3 @@ items.map((item) => (decodeURIComponent(item.src))) | ||
// Check if clicked element is an image declared in light box wrapper. | ||
if (event.target.nodeName === 'IMG') { | ||
if (!show && event.target.nodeName === 'IMG') { | ||
const activeIndex = memoizedPaths.indexOf(decodeURIComponent(event.target.src)); | ||
@@ -29,0 +29,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42002
983