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.8.0 to 1.8.1

2

CHANGELOG.md
#### Changelog
> 1.8.1
- Better hash history
> 1.8.0

@@ -3,0 +5,0 @@ - Support for horizontal scroll

@@ -72,2 +72,26 @@ 'use strict';

});
it('renders two components with hash replaced', function (done) {
var component = _react2.default.createElement(
'div',
null,
_react2.default.createElement(
_Link2.default,
{ to: 'test1', spy: true, smooth: true, hashSpy: true, saveHashHistory: false, duration: 500 },
'A'
),
';',
_react2.default.createElement(
_Link2.default,
{ to: 'test1', spy: true, smooth: true, saveHashHistory: false, duration: 500 },
'B'
),
';'
);
(0, _reactDom.render)(component, node, function () {
(0, _expect2.default)(node.textContent).toEqual('A;B;');
done();
});
});
});

4

modules/mixins/scroll-hash.js

@@ -63,5 +63,5 @@ 'use strict';

},
changeHash: function changeHash(to) {
changeHash: function changeHash(to, saveHashHistory) {
if (this.isInitialized() && _utils2.default.getHash() !== to) {
_utils2.default.pushHash(to);
_utils2.default.updateHash(to, saveHashHistory);
}

@@ -68,0 +68,0 @@ },

@@ -56,3 +56,4 @@ 'use strict';

ignoreCancelEvents: _propTypes2.default.bool,
hashSpy: _propTypes2.default.bool
hashSpy: _propTypes2.default.bool,
saveHashHistory: _propTypes2.default.bool
};

@@ -256,3 +257,6 @@

if (_this2.props.hashSpy && _scrollHash2.default.getHash() === to) {
_scrollHash2.default.changeHash();
var _props$saveHashHistor = _this2.props.saveHashHistory,
saveHashHistory = _props$saveHashHistor === undefined ? false : _props$saveHashHistor;
_scrollHash2.default.changeHash("", saveHashHistory);
}

@@ -269,4 +273,7 @@

_this2.props.hashSpy && _scrollHash2.default.changeHash(to);
var _props$saveHashHistor2 = _this2.props.saveHashHistory,
_saveHashHistory = _props$saveHashHistor2 === undefined ? false : _props$saveHashHistor2;
_this2.props.hashSpy && _scrollHash2.default.changeHash(to, _saveHashHistory);
if (_this2.props.spy) {

@@ -273,0 +280,0 @@ _this2.setState({ active: true });

@@ -6,12 +6,8 @@ "use strict";

});
var pushHash = function pushHash(hash) {
hash = hash ? hash.indexOf("#") === 0 ? hash : "#" + hash : "";
if (history.pushState) {
var loc = window.location;
history.pushState(null, null, hash ? loc.pathname + loc.search + hash : // remove hash
loc.pathname + loc.search);
} else {
location.hash = hash;
}
var updateHash = function updateHash(hash, historyUpdate) {
var hashVal = hash.indexOf("#") === 0 ? hash.substring(1) : hash;
var hashToUpdate = hashVal ? "#" + hashVal : "";
var curLoc = window && window.location;
var urlToPush = hashToUpdate ? curLoc.pathname + curLoc.search + hashToUpdate : curLoc.pathname + curLoc.search;
historyUpdate ? history.pushState(null, "", urlToPush) : history.replaceState(null, "", urlToPush);
};

@@ -37,3 +33,3 @@

exports.default = {
pushHash: pushHash,
updateHash: updateHash,
getHash: getHash,

@@ -40,0 +36,0 @@ filterElementInContainer: filterElementInContainer,

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

@@ -5,0 +5,0 @@ "main": "modules",

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