Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-scroll

Package Overview
Dependencies
Maintainers
1
Versions
118
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-scroll - npm Package Compare versions

Comparing version 1.5.2 to 1.5.3

17

modules/__tests__/animate-scroll-test.js

@@ -76,2 +76,4 @@ 'use strict';

window.scrollTo(0, 0);
node.style.cssText = "";
document.body.style.cssText = "";

@@ -99,2 +101,17 @@ (0, _reactDom.unmountComponentAtNode)(node);

it('scrolls to a position given a node as a container ', function (done) {
(0, _reactDom.render)(tallComponent, node, function () {
window.scrollTo(0, 0);
node.style.cssText = "position: fixed; top: 0; bottom: 200px; width 100%; overflow: scroll";
document.body.style.cssText = "overflow: hidden;";
_animateScroll2.default.scrollTo(400, { duration: duration, container: node });
setTimeout(function () {
(0, _expect2.default)(node.scrollTop).toEqual(400);
done();
}, waitDuration);
});
});
it('scrolls to an absolute position even if current position is higher', function (done) {

@@ -101,0 +118,0 @@ (0, _reactDom.render)(tallComponent, node, function () {

10

modules/__tests__/page-test.js

@@ -45,2 +45,4 @@ 'use strict';

var lastDivStyle = { height: "2000px" };
var component = _react2.default.createElement(

@@ -134,3 +136,3 @@ 'div',

'div',
{ id: 'anchor', name: 'test6', className: 'element' },
{ id: 'anchor', className: 'element', style: lastDivStyle },
'test 6'

@@ -141,9 +143,9 @@ )

beforeEach(function () {
_scrollEvents2.default.scrollEvent.remove('begin');
_scrollEvents2.default.scrollEvent.remove('end');
(0, _reactDom.unmountComponentAtNode)(node);
});
afterEach(function () {
(0, _reactDom.unmountComponentAtNode)(node);
window.scrollTo(0, 0);
_scrollEvents2.default.scrollEvent.remove('begin');
_scrollEvents2.default.scrollEvent.remove('end');
});

@@ -150,0 +152,0 @@

6

modules/components/Button.js

@@ -26,3 +26,7 @@ "use strict";

value: function render() {
return React.DOM.input(this.props, this.props.children);
return React.createElement(
'input',
this.props,
this.props.children
);
}

@@ -29,0 +33,0 @@ }]);

@@ -26,3 +26,7 @@ "use strict";

value: function render() {
return React.DOM.div(this.props, this.props.children);
return React.createElement(
'div',
this.props,
this.props.children
);
}

@@ -29,0 +33,0 @@ }]);

@@ -26,3 +26,7 @@ "use strict";

value: function render() {
return React.DOM.a(this.props, this.props.children);
return React.createElement(
'a',
this.props,
this.props.children
);
}

@@ -29,0 +33,0 @@ }]);

@@ -157,3 +157,3 @@ 'use strict';

var setContainer = function setContainer(options) {
if (!options || !options.containerId) {
if (!options || !options.containerId && (!options.container || !options.container.nodeType)) {
__containerElement = null;

@@ -163,3 +163,3 @@ return;

__containerElement = document.getElementById(options.containerId);
__containerElement = options.containerId ? document.getElementById(options.containerId) : options.container;
};

@@ -166,0 +166,0 @@

@@ -23,2 +23,3 @@ "use strict";

containerId: PropTypes.string,
container: PropTypes.object,
activeClass: PropTypes.string,

@@ -125,5 +126,14 @@ spy: PropTypes.bool,

var containerId = this.props.containerId;
var container = this.props.container;
var scrollSpyContainer = containerId ? document.getElementById(containerId) : document;
var scrollSpyContainer;
if (containerId) {
scrollSpyContainer = document.getElementById(containerId);
} else if (container && container.nodeType) {
scrollSpyContainer = container;
} else {
scrollSpyContainer = document;
}
if (!scrollSpy.isMounted(scrollSpyContainer)) {

@@ -130,0 +140,0 @@ scrollSpy.mount(scrollSpyContainer);

@@ -57,13 +57,23 @@ 'use strict';

var containerId = props.containerId;
var containerElement = containerId ? document.getElementById(containerId) : null;
var container = props.container;
var containerElement;
if (containerId) {
containerElement = document.getElementById(containerId);
} else if (container && container.nodeType) {
containerElement = container;
} else {
containerElement = null;
}
var scrollOffset;
if (containerId && containerElement) {
if ((containerId || container) && containerElement) {
props.absolute = true;
if (containerElement !== target.offsetParent) {
if (!containerElement.contains(target)) {
throw new Error('Container with ID ' + containerId + ' is not a parent of target ' + to);
throw new Error('Container with ID ' + (containerId || container) + ' is not a parent of target ' + to);
} else {
throw new Error('Container with ID ' + containerId + ' is not a positioned element');
throw new Error('Container with ID ' + (containerId || container) + ' is not a positioned element');
}

@@ -84,3 +94,3 @@ }

if (!props.smooth) {
if (containerId && containerElement) {
if ((containerId || container) && containerElement) {
containerElement.scrollTop = scrollOffset;

@@ -87,0 +97,0 @@ } else {

{
"name": "react-scroll",
"version": "1.5.2",
"version": "1.5.3",
"description": "A scroll component for React.js",

@@ -8,3 +8,3 @@ "main": "modules",

"type": "git",
"url": "https://github.com/fisshy/react-scroll.git"
"url": "git+https://github.com/fisshy/react-scroll.git"
},

@@ -18,3 +18,5 @@ "scripts": {

"homepage": "https://github.com/fisshy/react-scroll",
"bugs": "https://github.com/fisshy/react-scroll/issues",
"bugs": {
"url": "https://github.com/fisshy/react-scroll/issues"
},
"authors": [

@@ -70,3 +72,7 @@ "Joachim Karlsson"

]
}
},
"directories": {
"example": "examples"
},
"author": ""
}
## React Scroll
Directive for basic scrolling and smooth scrolling.
Component for basic scrolling and smooth scrolling.

@@ -368,2 +368,14 @@ ### Install

#### Changelog
> 1.5.3
- Fixes react error
> 1.5.2
- Fixes the way everything is built and transformed with babel.
> 1.5.0
- Now using class and extending React.Component to match later versions of react.
> v1.4.8
- Additional easings and animations added
> v1.4.0

@@ -370,0 +382,0 @@ - It's now possible to nest scroll areas and get a callback when "link is active"

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc