Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand Down
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -27,7 +30,7 @@
"author": "bySabi Files",
"license": "ISC",
"peerDependencies": {
"react": "^15.0.0",
"react": ">=15.0.0",
"fbjs": "*"
},
"devDependencies": {
Expand Down
7 changes: 7 additions & 0 deletions src/scrollchor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down