From a9d3b1a825142d8b1c73d132cc659dded45a8778 Mon Sep 17 00:00:00 2001 From: Sam L'ecuyer Date: Fri, 11 May 2018 17:21:16 -0700 Subject: [PATCH 1/2] check prototypes as well as equality Sometimes the equality check fails, but the prototype check succeeds. --- src/components/Dropdown.jsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/Dropdown.jsx b/src/components/Dropdown.jsx index f79c5a3..4bda19a 100644 --- a/src/components/Dropdown.jsx +++ b/src/components/Dropdown.jsx @@ -83,7 +83,7 @@ class Dropdown extends Component { }); // stick callback on trigger element const boundChildren = React.Children.map(children, child => { - if (child.type === DropdownTrigger) { + if (child.type === DropdownTrigger || child.type.prototype instanceof DropdownTrigger) { const originalOnClick = child.props.onClick; child = cloneElement(child, { ref: 'trigger', @@ -96,7 +96,7 @@ class Dropdown extends Component { } } }); - } else if (child.type === DropdownContent && removeElement && !active) { + } else if ((child.type === DropdownContent || child.type.prototype instanceof DropdownContent) && removeElement && !active) { child = null; } return child; From 40a31f8aac4b4ea74e1a2c0a28b89db47f841d97 Mon Sep 17 00:00:00 2001 From: Sam L'ecuyer Date: Fri, 11 May 2018 17:22:35 -0700 Subject: [PATCH 2/2] allow react16, bump package version --- package.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index c2d19d1..da3f32d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-simple-dropdown", - "version": "3.2.0", + "version": "3.2.1", "description": "Non-prescriptive React.js dropdown toolkit", "main": "lib/components/Dropdown.js", "scripts": { @@ -78,7 +78,7 @@ "zuul": "^3.11.1" }, "peerDependencies": { - "react": "0.14.x || 15.x", - "react-dom": "0.14.x || 15.x" + "react": "0.14.x || 15.x || 16.x", + "react-dom": "0.14.x || 15.x || 16.x" } }