yet-another-react-lightbox 3.15.3 → 3.15.5
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.
- package/dist/index.js +18 -9
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -268,12 +268,15 @@ function reducer(state, action) {
|
|
|
268
268
|
return { slides, currentIndex, globalIndex, currentSlide, animation };
|
|
269
269
|
}
|
|
270
270
|
case "update":
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
271
|
+
if (action.slides !== state.slides || action.index !== state.currentIndex) {
|
|
272
|
+
return {
|
|
273
|
+
slides: action.slides,
|
|
274
|
+
currentIndex: action.index,
|
|
275
|
+
globalIndex: action.index,
|
|
276
|
+
currentSlide: getSlideIfPresent(action.slides, action.index),
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
return state;
|
|
277
280
|
default:
|
|
278
281
|
throw new Error(UNKNOWN_ACTION_TYPE);
|
|
279
282
|
}
|
|
@@ -1320,11 +1323,14 @@ function Portal({ children, animation, styles, className, on, portal, close }) {
|
|
|
1320
1323
|
setVisible(false);
|
|
1321
1324
|
};
|
|
1322
1325
|
}, []);
|
|
1326
|
+
const handleCleanup = useEventCallback(() => {
|
|
1327
|
+
cleanup.current.forEach((clean) => clean());
|
|
1328
|
+
cleanup.current = [];
|
|
1329
|
+
});
|
|
1323
1330
|
const handleClose = useEventCallback(() => {
|
|
1324
1331
|
var _a;
|
|
1325
1332
|
setVisible(false);
|
|
1326
|
-
|
|
1327
|
-
cleanup.current = [];
|
|
1333
|
+
handleCleanup();
|
|
1328
1334
|
(_a = on.exiting) === null || _a === void 0 ? void 0 : _a.call(on);
|
|
1329
1335
|
setTimeout(() => {
|
|
1330
1336
|
var _a;
|
|
@@ -1359,7 +1365,10 @@ function Portal({ children, animation, styles, className, on, portal, close }) {
|
|
|
1359
1365
|
if (node) {
|
|
1360
1366
|
handleEnter(node);
|
|
1361
1367
|
}
|
|
1362
|
-
|
|
1368
|
+
else {
|
|
1369
|
+
handleCleanup();
|
|
1370
|
+
}
|
|
1371
|
+
}, [handleEnter, handleCleanup]);
|
|
1363
1372
|
return mounted
|
|
1364
1373
|
? 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
1374
|
...(animation.fade !== LightboxDefaultProps.animation.fade
|