From e3308395212bef07d1f3c05f413cac3dd245ac98 Mon Sep 17 00:00:00 2001 From: Jordan Harband Date: Thu, 24 Aug 2017 00:54:10 -0700 Subject: [PATCH] [Fix] OutsideClickHandler: ensure this.childNode exists Closes #437. --- src/components/OutsideClickHandler.jsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/OutsideClickHandler.jsx b/src/components/OutsideClickHandler.jsx index f739567451..531c195ee1 100644 --- a/src/components/OutsideClickHandler.jsx +++ b/src/components/OutsideClickHandler.jsx @@ -38,9 +38,11 @@ export default class OutsideClickHandler extends React.Component { } onOutsideClick(e) { - const isDescendantOfRoot = this.childNode.contains(e.target); + const { onOutsideClick } = this.props; + const { childNode } = this; + const isDescendantOfRoot = childNode && childNode.contains(e.target); if (!isDescendantOfRoot) { - this.props.onOutsideClick(e); + onOutsideClick(e); } }