From 5e82ac46b07706b2e56d9a16593e0d0f0c9c78d4 Mon Sep 17 00:00:00 2001 From: mightyplow Date: Thu, 22 Jun 2017 11:47:28 +0200 Subject: [PATCH] fixes the issue with not updated animate settings the component updates the animate options, whenever it receives new props --- src/scrollchor.jsx | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/scrollchor.jsx b/src/scrollchor.jsx index dc1b64b..b47fe7a 100644 --- a/src/scrollchor.jsx +++ b/src/scrollchor.jsx @@ -26,6 +26,15 @@ 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();