react-image-gallery
Advanced tools
Comparing version 0.8.8 to 0.8.9
@@ -128,13 +128,15 @@ 'use strict'; | ||
_this._initGalleryResizing = (0, _lodash4.default)(function (element) { | ||
_this._initGalleryResizing = function (element) { | ||
/* | ||
When image-gallery-slide-wrapper unmounts and mounts again ref is called twice, | ||
once with null and another with the element. | ||
Use debounce to prevent the null call. | ||
https://reactjs.org/docs/refs-and-the-dom.html#caveats-with-callback-refs | ||
When image-gallery-slide-wrapper unmounts and mounts when thumbnail bar position is changed | ||
ref is called twice, once with null and another with the element. | ||
Make sure element is available before calling observe. | ||
*/ | ||
_this._imageGallerySlideWrapper = element; | ||
_this.resizeObserver = new _resizeObserverPolyfill2.default(_this._createResizeObserver); | ||
_this.resizeObserver.observe(element); | ||
}, 100); | ||
if (element) { | ||
_this._imageGallerySlideWrapper = element; | ||
_this.resizeObserver = new _resizeObserverPolyfill2.default(_this._createResizeObserver); | ||
_this.resizeObserver.observe(element); | ||
} | ||
}; | ||
_this._createResizeObserver = (0, _lodash4.default)(function (entries) { | ||
@@ -141,0 +143,0 @@ entries.forEach(function () { |
{ | ||
"name": "react-image-gallery", | ||
"version": "0.8.8", | ||
"version": "0.8.9", | ||
"description": "React carousel image gallery component with thumbnail and mobile support", | ||
@@ -5,0 +5,0 @@ "main": "./build/image-gallery.js", |
@@ -412,13 +412,14 @@ import React from 'react'; | ||
_initGalleryResizing = debounce((element) => { | ||
_initGalleryResizing = (element) => { | ||
/* | ||
When image-gallery-slide-wrapper unmounts and mounts again ref is called twice, | ||
once with null and another with the element. | ||
Use debounce to prevent the null call. | ||
https://reactjs.org/docs/refs-and-the-dom.html#caveats-with-callback-refs | ||
When image-gallery-slide-wrapper unmounts and mounts when thumbnail bar position is changed | ||
ref is called twice, once with null and another with the element. | ||
Make sure element is available before calling observe. | ||
*/ | ||
this._imageGallerySlideWrapper = element; | ||
this.resizeObserver = new ResizeObserver(this._createResizeObserver); | ||
this.resizeObserver.observe(element); | ||
}, 100); | ||
if (element) { | ||
this._imageGallerySlideWrapper = element; | ||
this.resizeObserver = new ResizeObserver(this._createResizeObserver); | ||
this.resizeObserver.observe(element); | ||
} | ||
}; | ||
@@ -425,0 +426,0 @@ _createResizeObserver = debounce((entries) => { |
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
2884
128676