From cd31dcc4bf0a465ae1e5372b62269cfdd8c31ba2 Mon Sep 17 00:00:00 2001 From: bySabi Files Date: Thu, 4 May 2017 21:53:18 +0200 Subject: [PATCH 1/2] remove npm@2 support --- CHANGELOG.md | 5 +++++ README.md | 5 +---- package.json | 5 ++++- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d82985..0282707 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ ## master (unreleased) +## 3.0.0 + +- Add React 15.5.x support +- Deprecate React 0.14 peer dependencie + ## 2.2.0 - Add beforeAnimate/afterAnimate hooks to scroll handler diff --git a/README.md b/README.md index b74b4db..7613fcc 100644 --- a/README.md +++ b/README.md @@ -25,10 +25,7 @@ npm install react-scrollchor --save ### Dependencies * User should provide its own `React` package -* on `npm 2` enviroments, package [fbjs](https://www.npmjs.com/package/fbjs) should be installed too: -```bash -npm install fbjs --save -``` + #### `fbjs` package [fbjs](https://www.npmjs.com/package/fbjs) is a collection of utility libraries created by React Team. It include useful modules like `warning` and `invariant` diff --git a/package.json b/package.json index 3bd1fc5..b585a4a 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,9 @@ ], "repository": "https://github.com/bySabi/react-scrollchor.git", "main": "lib/scrollchor.js", + "engines": { + "npm": ">=3.0" + }, "scripts": { "build-npm": "rimraf lib && mkdirp lib && babel src/ -d lib/", "lint": "eslint . --ext .js,.jsx", @@ -27,7 +30,7 @@ "author": "bySabi Files", "license": "ISC", "peerDependencies": { - "react": "^15.0.0", + "react": ">=15.0.0", "fbjs": "*" }, "devDependencies": { From 6804f16373e3f6244a1a9e741bd24fd3774e406e Mon Sep 17 00:00:00 2001 From: mightyplow Date: Fri, 23 Jun 2017 06:55:13 +0200 Subject: [PATCH 2/2] make animation settings changable This fixes the issue of animation settings not being applied after the component has been constructed. --- src/scrollchor.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/scrollchor.jsx b/src/scrollchor.jsx index dc1b64b..7a7ee71 100644 --- a/src/scrollchor.jsx +++ b/src/scrollchor.jsx @@ -26,6 +26,13 @@ export default class Scrollchor extends React.Component { afterAnimate: PropTypes.func }; + componentWillReceiveProps ({ animate }) { + const { + offset = 0, duration = 400, easing = easeOutQuad + } = animate || {}; + this._animate = { offset, duration, easing }; + } + handleClick = (event) => { this._beforeAnimate(event); event.preventDefault();