oolib 2.132.6 → 2.132.7
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.
|
@@ -36,18 +36,31 @@ var CaretLeft = icons_1.icons.CaretLeft, CaretRight = icons_1.icons.CaretRight;
|
|
|
36
36
|
var SliderShell = function (_a) {
|
|
37
37
|
var value = _a.value, activeIdx = _a.activeIdx, setActiveIdx = _a.setActiveIdx, render = _a.render;
|
|
38
38
|
var _b = (0, ImageInputContext_1.useImageInputContext)(), aspectRatio = _b.aspectRatio, isLoading = _b.isLoading, imageUnderEdit = _b.imageUnderEdit;
|
|
39
|
+
var _c = (0, react_1.useState)(false), isHeightSet = _c[0], setIsHeightSet = _c[1];
|
|
39
40
|
var wrapperRef = (0, react_1.useRef)(null);
|
|
40
|
-
var
|
|
41
|
+
var _d = (0, react_1.useState)(undefined), imageMinusCaptionHeight = _d[0], setImageMinusCaptionHeight = _d[1];
|
|
41
42
|
var updateHeight = function () {
|
|
42
43
|
if (wrapperRef.current) {
|
|
43
44
|
setImageMinusCaptionHeight(wrapperRef.current.clientWidth / (0, calcAspectRatio_1.calcAspectRatio)(aspectRatio));
|
|
45
|
+
setIsHeightSet(true);
|
|
44
46
|
}
|
|
45
47
|
};
|
|
46
48
|
(0, react_1.useEffect)(function () {
|
|
47
49
|
updateHeight();
|
|
48
50
|
window.addEventListener('resize', updateHeight);
|
|
51
|
+
console.log({ imageMinusCaptionHeight: imageMinusCaptionHeight, wrapperRef: wrapperRef });
|
|
52
|
+
var intervalId = setInterval(function () {
|
|
53
|
+
// to avoid issues in cases where height is initally 0 because parent block has display:hidden condition on initial render
|
|
54
|
+
if (!isHeightSet) {
|
|
55
|
+
updateHeight();
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
clearInterval(intervalId);
|
|
59
|
+
}
|
|
60
|
+
}, 100);
|
|
49
61
|
return function () {
|
|
50
62
|
window.removeEventListener('resize', updateHeight);
|
|
63
|
+
intervalId && clearInterval(intervalId);
|
|
51
64
|
};
|
|
52
65
|
}, []);
|
|
53
66
|
return (react_1.default.createElement(styled_1.StyledFlexWrapper, { ref: wrapperRef },
|