From a8a6549647b49a94c281690e92a3bed2938b756b Mon Sep 17 00:00:00 2001 From: Jacek Radko Date: Thu, 6 Sep 2018 14:25:20 -0500 Subject: [PATCH 1/3] Do not declare isReactComponent --- src/ReactHoverObserver.js | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/ReactHoverObserver.js b/src/ReactHoverObserver.js index 67662d4..48e14d6 100644 --- a/src/ReactHoverObserver.js +++ b/src/ReactHoverObserver.js @@ -118,14 +118,10 @@ export default class extends React.Component { } } - isReactComponent(reactElement) { - return typeof reactElement.type === 'function'; - } - shouldDecorateChild(child) { return ( !!child && - this.isReactComponent(child) && + typeof child.type === 'function' && this.props.shouldDecorateChildren ); } From 33f0346dea44b710832b046c31a8e5a653baa402 Mon Sep 17 00:00:00 2001 From: Jacek Radko Date: Sat, 8 Sep 2018 07:59:05 -0500 Subject: [PATCH 2/3] Updated typeof check to getIsReactComponent --- src/ReactHoverObserver.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/ReactHoverObserver.js b/src/ReactHoverObserver.js index 48e14d6..ba9cf64 100644 --- a/src/ReactHoverObserver.js +++ b/src/ReactHoverObserver.js @@ -118,10 +118,14 @@ export default class extends React.Component { } } + getIsReactComponent(reactElement) { + return typeof reactElement.type === 'function'; + } + shouldDecorateChild(child) { return ( !!child && - typeof child.type === 'function' && + this.getIsReactComponent(child) && this.props.shouldDecorateChildren ); } From 8dec5c7172c13a73ea05741dc6724ff64f54063f Mon Sep 17 00:00:00 2001 From: Jacek Radko Date: Sat, 8 Sep 2018 08:00:03 -0500 Subject: [PATCH 3/3] Removed extra spaces --- src/ReactHoverObserver.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ReactHoverObserver.js b/src/ReactHoverObserver.js index ba9cf64..04198c0 100644 --- a/src/ReactHoverObserver.js +++ b/src/ReactHoverObserver.js @@ -118,8 +118,8 @@ export default class extends React.Component { } } - getIsReactComponent(reactElement) { - return typeof reactElement.type === 'function'; + getIsReactComponent(reactElement) { + return typeof reactElement.type === 'function'; } shouldDecorateChild(child) {