|
| 1 | +diff --git a/node_modules/react-slick/lib/inner-slider.js b/node_modules/react-slick/lib/inner-slider.js |
| 2 | +index ab9c65f..e569d1d 100644 |
| 3 | +--- a/node_modules/react-slick/lib/inner-slider.js |
| 4 | ++++ b/node_modules/react-slick/lib/inner-slider.js |
| 5 | +@@ -59,6 +59,29 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g |
| 6 | + |
| 7 | + function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } |
| 8 | + |
| 9 | ++// We will be ignoring width changes in react-slick because of the following issue: |
| 10 | ++// https://github.com/akiran/react-slick/issues/2368 |
| 11 | ++// |
| 12 | ++// In mobile, while scrolling up and down the resize event is triggered and the slider attempts to recalculate |
| 13 | ++// inner properties based on it. This is buggy and causes the slider to change speed. |
| 14 | ++// https://stackoverflow.com/questions/17328742/mobile-chrome-fires-resize-event-on-scroll |
| 15 | ++let __globalOuterWidth; |
| 16 | ++ |
| 17 | ++function __hasChangedWidth() { |
| 18 | ++ if (typeof window !== 'undefined') { |
| 19 | ++ const width = window.outerWidth; |
| 20 | ++ |
| 21 | ++ if (width !== __globalOuterWidth) { |
| 22 | ++ __globalOuterWidth = width; |
| 23 | ++ return true; |
| 24 | ++ } else { |
| 25 | ++ return false; |
| 26 | ++ } |
| 27 | ++ } |
| 28 | ++ |
| 29 | ++ return false; |
| 30 | ++} |
| 31 | ++ |
| 32 | + var InnerSlider = /*#__PURE__*/function (_React$Component) { |
| 33 | + _inherits(InnerSlider, _React$Component); |
| 34 | + |
| 35 | +@@ -142,9 +165,9 @@ var InnerSlider = /*#__PURE__*/function (_React$Component) { |
| 36 | + }); |
| 37 | + |
| 38 | + if (window.addEventListener) { |
| 39 | +- window.addEventListener("resize", _this.onWindowResized); |
| 40 | ++ window.addEventListener("resize", _this.wrappedOnWindowResized); |
| 41 | + } else { |
| 42 | +- window.attachEvent("onresize", _this.onWindowResized); |
| 43 | ++ window.attachEvent("onresize", _this.wrappedOnWindowResized); |
| 44 | + } |
| 45 | + }); |
| 46 | + |
| 47 | +@@ -166,9 +189,9 @@ var InnerSlider = /*#__PURE__*/function (_React$Component) { |
| 48 | + } |
| 49 | + |
| 50 | + if (window.addEventListener) { |
| 51 | +- window.removeEventListener("resize", _this.onWindowResized); |
| 52 | ++ window.removeEventListener("resize", _this.wrappedOnWindowResized); |
| 53 | + } else { |
| 54 | +- window.detachEvent("onresize", _this.onWindowResized); |
| 55 | ++ window.detachEvent("onresize", _this.wrappedOnWindowResized); |
| 56 | + } |
| 57 | + |
| 58 | + if (_this.autoplayTimer) { |
| 59 | +@@ -237,6 +260,13 @@ var InnerSlider = /*#__PURE__*/function (_React$Component) { |
| 60 | + _this.debouncedResize(); |
| 61 | + }); |
| 62 | + |
| 63 | ++ _defineProperty(_assertThisInitialized(_this), "wrappedOnWindowResized", function (setTrackStyle) { |
| 64 | ++ if (!__hasChangedWidth()) { |
| 65 | ++ return; |
| 66 | ++ } |
| 67 | ++ _this.onWindowResized(setTrackStyle); |
| 68 | ++ }); |
| 69 | ++ |
| 70 | + _defineProperty(_assertThisInitialized(_this), "resizeWindow", function () { |
| 71 | + var setTrackStyle = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; |
| 72 | + var isTrackMounted = Boolean(_this.track && _this.track.node); // prevent warning: setting state on unmounted component (server side rendering) |
0 commit comments