yet-another-react-lightbox 3.15.3 → 3.15.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +9 -3
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1320,11 +1320,14 @@ function Portal({ children, animation, styles, className, on, portal, close }) {
1320
1320
  setVisible(false);
1321
1321
  };
1322
1322
  }, []);
1323
+ const handleCleanup = useEventCallback(() => {
1324
+ cleanup.current.forEach((clean) => clean());
1325
+ cleanup.current = [];
1326
+ });
1323
1327
  const handleClose = useEventCallback(() => {
1324
1328
  var _a;
1325
1329
  setVisible(false);
1326
- cleanup.current.forEach((clean) => clean());
1327
- cleanup.current = [];
1330
+ handleCleanup();
1328
1331
  (_a = on.exiting) === null || _a === void 0 ? void 0 : _a.call(on);
1329
1332
  setTimeout(() => {
1330
1333
  var _a;
@@ -1359,7 +1362,10 @@ function Portal({ children, animation, styles, className, on, portal, close }) {
1359
1362
  if (node) {
1360
1363
  handleEnter(node);
1361
1364
  }
1362
- }, [handleEnter]);
1365
+ else {
1366
+ handleCleanup();
1367
+ }
1368
+ }, [handleEnter, handleCleanup]);
1363
1369
  return mounted
1364
1370
  ? createPortal(React.createElement("div", { ref: handleRef, className: clsx(className, cssClass("root"), cssClass(cssPrefix$1()), cssClass(CLASS_NO_SCROLL_PADDING), visible && cssClass(cssPrefix$1("open"))), role: "presentation", "aria-live": "polite", style: {
1365
1371
  ...(animation.fade !== LightboxDefaultProps.animation.fade
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yet-another-react-lightbox",
3
- "version": "3.15.3",
3
+ "version": "3.15.4",
4
4
  "description": "Modern React lightbox component",
5
5
  "author": "Igor Danchenko",
6
6
  "license": "MIT",