From 3396f4a46e493c9bf79c85fb0707a24a994091b0 Mon Sep 17 00:00:00 2001 From: David Chouinard Date: Thu, 10 Mar 2016 17:59:06 -0800 Subject: [PATCH 1/2] Don't show scrollbars if content is not scrollable --- src/components/scroll-region.cjsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/components/scroll-region.cjsx b/src/components/scroll-region.cjsx index aa8b2ebdf..fb2e2c82e 100644 --- a/src/components/scroll-region.cjsx +++ b/src/components/scroll-region.cjsx @@ -100,6 +100,7 @@ class Scrollbar extends React.Component bottom: 0 right: 0 zIndex: 2 + visibility: "hidden" if @state.totalHeight != 0 && @state.totalHeight == @state.viewportHeight _onHandleDown: (event) => handleNode = React.findDOMNode(@refs.handle) From d0baf878f5cad026b65965b62e8dc2d9e209594d Mon Sep 17 00:00:00 2001 From: David Chouinard Date: Thu, 10 Mar 2016 18:37:45 -0800 Subject: [PATCH 2/2] Ensure scroll bar state is updated on content change --- src/components/scroll-region.cjsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/scroll-region.cjsx b/src/components/scroll-region.cjsx index fb2e2c82e..ed9f28af1 100644 --- a/src/components/scroll-region.cjsx +++ b/src/components/scroll-region.cjsx @@ -198,6 +198,10 @@ class ScrollRegion extends React.Component attributeFilter: ['style'] }) + componentDidUpdate: (prevProps, prevState) => + if (@props.children != prevProps.children) + @recomputeDimensions() + componentWillReceiveProps: (props) => if @shouldInvalidateScrollbarComponent(props) @_scrollbarComponent = null