From d8da09b50e6299fc591e869abf50c24ac15e44f7 Mon Sep 17 00:00:00 2001 From: Philip DiLeo Date: Thu, 18 May 2017 21:49:14 -0400 Subject: [PATCH] Add ComponentDidUpdate Functionality (#11) The react-perfect-scrollbar works well on initial render, but if the underlying content changes in size, the scrollbar size does not update until you manually interact with the scrollbar. By adding this function, the scrollbar will update any time the content size changes. --- src/scrollbar.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/scrollbar.js b/src/scrollbar.js index 8a71d85..808cddf 100644 --- a/src/scrollbar.js +++ b/src/scrollbar.js @@ -36,6 +36,10 @@ export default class ScrollBar extends Component { }); } + componentDidUpdate() { + ps.update(this._container); + } + componentWillUnmount() { // unhook up evens Object.keys(this._handlerByEvent).forEach((value, key) => {