From fdeda4e189475928078e27a5c1d5b1c53abb2198 Mon Sep 17 00:00:00 2001 From: Ryan Soury Date: Fri, 22 Jun 2018 01:41:36 +1000 Subject: [PATCH 1/2] added preact compatibility. used with preact-compate --- index.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 614f4aa..b494442 100644 --- a/index.js +++ b/index.js @@ -28,7 +28,10 @@ function enhanceWithClickOutside(Component: React.ComponentType<*>) { handleClickOutside(e) { const domNode = this.__domNode; if ( - (!domNode || !domNode.contains(e.target)) && + (!domNode || + (domNode.contains + ? !domNode.contains(e.target) + : !domNode.base.contains(e.target))) && this.__wrappedInstance && typeof this.__wrappedInstance.handleClickOutside === 'function' ) { From f9622599a114cc21d86ff86f0f3bb71623f8e439 Mon Sep 17 00:00:00 2001 From: Ryan Soury Date: Fri, 22 Jun 2018 01:48:26 +1000 Subject: [PATCH 2/2] built locally --- dist/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dist/index.js b/dist/index.js index 6e3b789..57448d4 100644 --- a/dist/index.js +++ b/dist/index.js @@ -45,7 +45,7 @@ function enhanceWithClickOutside(Component) { key: 'handleClickOutside', value: function handleClickOutside(e) { var domNode = this.__domNode; - if ((!domNode || !domNode.contains(e.target)) && this.__wrappedInstance && typeof this.__wrappedInstance.handleClickOutside === 'function') { + if ((!domNode || (domNode.contains ? !domNode.contains(e.target) : !domNode.base.contains(e.target))) && this.__wrappedInstance && typeof this.__wrappedInstance.handleClickOutside === 'function') { this.__wrappedInstance.handleClickOutside(e); } }