Skip to content

Commit e330839

Browse files
committed
[Fix] OutsideClickHandler: ensure this.childNode exists
Closes #437.
1 parent 4de2733 commit e330839

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/components/OutsideClickHandler.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,11 @@ export default class OutsideClickHandler extends React.Component {
3838
}
3939

4040
onOutsideClick(e) {
41-
const isDescendantOfRoot = this.childNode.contains(e.target);
41+
const { onOutsideClick } = this.props;
42+
const { childNode } = this;
43+
const isDescendantOfRoot = childNode && childNode.contains(e.target);
4244
if (!isDescendantOfRoot) {
43-
this.props.onOutsideClick(e);
45+
onOutsideClick(e);
4446
}
4547
}
4648

0 commit comments

Comments
 (0)