From c2fa0e0a11f3f424b6098c5de987c0fd231a06d3 Mon Sep 17 00:00:00 2001 From: BDav24 Date: Tue, 14 Feb 2017 08:54:14 +0100 Subject: [PATCH 1/6] Remove findDOMNode --- src/sidebar.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/sidebar.js b/src/sidebar.js index ca6444b7f4..62565aa177 100755 --- a/src/sidebar.js +++ b/src/sidebar.js @@ -180,7 +180,7 @@ class Sidebar extends React.Component { } saveSidebarWidth() { - const width = ReactDOM.findDOMNode(this.refs.sidebar).offsetWidth; + const width = this.sidebar.offsetWidth; if (width !== this.state.sidebarWidth) { this.setState({sidebarWidth: width}); @@ -312,7 +312,8 @@ class Sidebar extends React.Component { return (
-
+
this.sidebar = node}> {this.props.sidebar}
Date: Tue, 14 Feb 2017 09:26:29 +0100 Subject: [PATCH 2/6] fix linters --- src/sidebar.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/sidebar.js b/src/sidebar.js index 62565aa177..0442d2a2fd 100755 --- a/src/sidebar.js +++ b/src/sidebar.js @@ -1,5 +1,4 @@ import React from 'react'; -import ReactDOM from 'react-dom'; const CANCEL_DISTANCE_ON_SCROLL = 20; @@ -313,7 +312,7 @@ class Sidebar extends React.Component { return (
this.sidebar = node}> + ref={node => (this.sidebar = node)}> {this.props.sidebar}
Date: Wed, 15 Feb 2017 19:15:56 +0100 Subject: [PATCH 3/6] Simplify sidebar ref --- src/sidebar.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/sidebar.js b/src/sidebar.js index 0442d2a2fd..40a7aaa577 100755 --- a/src/sidebar.js +++ b/src/sidebar.js @@ -179,7 +179,7 @@ class Sidebar extends React.Component { } saveSidebarWidth() { - const width = this.sidebar.offsetWidth; + const width = this.refs.sidebar.offsetWidth; if (width !== this.state.sidebarWidth) { this.setState({sidebarWidth: width}); @@ -311,8 +311,7 @@ class Sidebar extends React.Component { return (
-
(this.sidebar = node)}> +
{this.props.sidebar}
Date: Wed, 15 Feb 2017 19:54:57 +0100 Subject: [PATCH 4/6] Back to sidebar ref callback --- src/sidebar.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/sidebar.js b/src/sidebar.js index 40a7aaa577..3ce10fc80c 100755 --- a/src/sidebar.js +++ b/src/sidebar.js @@ -76,6 +76,8 @@ class Sidebar extends React.Component { this.onScroll = this.onScroll.bind(this); } + saveSidebarRef = (node) => this.sidebar = node; + componentDidMount() { this.setState({ dragSupported: typeof window === 'object' && 'ontouchstart' in window, @@ -179,7 +181,7 @@ class Sidebar extends React.Component { } saveSidebarWidth() { - const width = this.refs.sidebar.offsetWidth; + const width = this.sidebar.offsetWidth; if (width !== this.state.sidebarWidth) { this.setState({sidebarWidth: width}); @@ -311,7 +313,7 @@ class Sidebar extends React.Component { return (
-
+
{this.props.sidebar}
Date: Wed, 15 Feb 2017 20:02:02 +0100 Subject: [PATCH 5/6] Fix class property error --- src/sidebar.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/sidebar.js b/src/sidebar.js index 3ce10fc80c..04a1c74af1 100755 --- a/src/sidebar.js +++ b/src/sidebar.js @@ -74,10 +74,9 @@ class Sidebar extends React.Component { this.onTouchMove = this.onTouchMove.bind(this); this.onTouchEnd = this.onTouchEnd.bind(this); this.onScroll = this.onScroll.bind(this); + this.saveSidebarRef = this.saveSidebarRef.bind(this); } - saveSidebarRef = (node) => this.sidebar = node; - componentDidMount() { this.setState({ dragSupported: typeof window === 'object' && 'ontouchstart' in window, @@ -188,6 +187,10 @@ class Sidebar extends React.Component { } } + saveSidebarRef(node) { + this.sidebar = node; + } + // calculate the sidebarWidth based on current touch info touchSidebarWidth() { // if the sidebar is open and start point of drag is inside the sidebar From 2b3d0510c6f9af653166dff6c0662544b94b8a8a Mon Sep 17 00:00:00 2001 From: BDav24 Date: Wed, 15 Feb 2017 20:43:08 +0100 Subject: [PATCH 6/6] Fix eslint error --- src/sidebar.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/sidebar.js b/src/sidebar.js index 04a1c74af1..60cab6650d 100755 --- a/src/sidebar.js +++ b/src/sidebar.js @@ -188,7 +188,7 @@ class Sidebar extends React.Component { } saveSidebarRef(node) { - this.sidebar = node; + this.sidebar = node; } // calculate the sidebarWidth based on current touch info