Closed shahnad closed 3 months ago
Patch to apply via patch-package to resolve issue : (waiting for PR to be merged https://github.com/tajo/react-range/pull/182)
react-range+1.8.14.patch
diff --git a/node_modules/react-range/lib/Range.js b/node_modules/react-range/lib/Range.js
index 2403f9d..f276ec3 100644
--- a/node_modules/react-range/lib/Range.js
+++ b/node_modules/react-range/lib/Range.js
@@ -68,6 +68,10 @@ var Range = /** @class */ (function (_super) {
_this.getOffsets = function () {
var _a = _this.props, direction = _a.direction, values = _a.values, min = _a.min, max = _a.max;
var trackElement = _this.trackRef.current;
+ if (!trackElement) {
+ console.warn('No track element found.');
+ return [];
+ }
var trackRect = trackElement.getBoundingClientRect();
var trackPadding = (0, utils_1.getPaddingAndBorder)(trackElement);
return _this.getThumbs().map(function (thumb, index) {
@@ -523,7 +527,9 @@ var Range = /** @class */ (function (_super) {
document.removeEventListener('touchstart', this.onMouseOrTouchStart);
document.removeEventListener('mouseup', this.schdOnEnd);
document.removeEventListener('touchend', this.schdOnEnd);
- this.resizeObserver.unobserve(this.trackRef.current);
+ if (this.trackRef && this.trackRef.current) {
+ this.resizeObserver.unobserve(this.trackRef.current);
+ }
};
Range.prototype.render = function () {
var _this = this;
should be fixed
Hi, I don't know why this happening. if anyone can reproduce it. it will be appreciatable. Thanks
"react-range": "^1.8.14",