react-remove-scroll
Advanced tools
Comparing version 1.0.2 to 1.0.3
@@ -19,3 +19,4 @@ import * as tslib_1 from "tslib"; | ||
_this.shouldPrevent = function (event) { | ||
if (RemoveScroll.stack[RemoveScroll.stack.length - 1] !== _this) { | ||
var stack = RemoveScroll.stack.filter(function (el) { return el.props.enabled; }); | ||
if (!stack.length || stack[stack.length - 1] !== _this) { | ||
return; | ||
@@ -22,0 +23,0 @@ } |
@@ -0,1 +1,2 @@ | ||
var elementCouldBeScrolled = function (node) { return (window.getComputedStyle(node).overflowX !== 'hidden'); }; | ||
export var handleScroll = function (endTarget, event, sourceDelta) { | ||
@@ -11,4 +12,9 @@ var delta = sourceDelta; | ||
var scrollTop = target.scrollTop, scrollHeight = target.scrollHeight, clientHeight = target.clientHeight; | ||
availableScroll += scrollHeight - clientHeight - scrollTop; | ||
availableScrollTop += scrollTop; | ||
var elementScroll = scrollHeight - clientHeight - scrollTop; | ||
if (scrollTop || elementScroll) { | ||
if (elementCouldBeScrolled(target)) { | ||
availableScroll += elementScroll; | ||
availableScrollTop += scrollTop; | ||
} | ||
} | ||
target = target.parentNode; | ||
@@ -15,0 +21,0 @@ } while ((!targetInLock && target !== document.body) || |
@@ -21,3 +21,4 @@ "use strict"; | ||
_this.shouldPrevent = function (event) { | ||
if (RemoveScroll.stack[RemoveScroll.stack.length - 1] !== _this) { | ||
var stack = RemoveScroll.stack.filter(function (el) { return el.props.enabled; }); | ||
if (!stack.length || stack[stack.length - 1] !== _this) { | ||
return; | ||
@@ -24,0 +25,0 @@ } |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var elementCouldBeScrolled = function (node) { return (window.getComputedStyle(node).overflowX !== 'hidden'); }; | ||
exports.handleScroll = function (endTarget, event, sourceDelta) { | ||
@@ -13,4 +14,9 @@ var delta = sourceDelta; | ||
var scrollTop = target.scrollTop, scrollHeight = target.scrollHeight, clientHeight = target.clientHeight; | ||
availableScroll += scrollHeight - clientHeight - scrollTop; | ||
availableScrollTop += scrollTop; | ||
var elementScroll = scrollHeight - clientHeight - scrollTop; | ||
if (scrollTop || elementScroll) { | ||
if (elementCouldBeScrolled(target)) { | ||
availableScroll += elementScroll; | ||
availableScrollTop += scrollTop; | ||
} | ||
} | ||
target = target.parentNode; | ||
@@ -17,0 +23,0 @@ } while ((!targetInLock && target !== document.body) || |
{ | ||
"name": "react-remove-scroll", | ||
"version": "1.0.2", | ||
"version": "1.0.3", | ||
"description": "Disables scroll outside of `children` node.", | ||
@@ -5,0 +5,0 @@ "main": "dist/es5/index.js", |
react-remove-scroll | ||
==== | ||
[![NPM version](https://img.shields.io/npm/v/react-remove-scroll.svg)](https://www.npmjs.com/package/react-remove-scroll) | ||
Disables scroll outside of `children` node. | ||
@@ -13,3 +15,3 @@ | ||
```js | ||
import {RemoveScroll} from 'react-remove-scroll-bar'; | ||
import {RemoveScroll} from 'react-remove-scroll'; | ||
@@ -16,0 +18,0 @@ <RemoveScroll> |
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
20862
386
91