From c9e68026634b9aa872e43038f45d20c209f1978e Mon Sep 17 00:00:00 2001 From: Justin Kahn Date: Fri, 21 Jun 2019 14:40:44 +0800 Subject: [PATCH] fix(Overlay): check if instance of React Component --- src/overlay/overlay.jsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/overlay/overlay.jsx b/src/overlay/overlay.jsx index 74fef033c6..a7840df17a 100644 --- a/src/overlay/overlay.jsx +++ b/src/overlay/overlay.jsx @@ -697,7 +697,11 @@ export default class Overlay extends Component { stateVisible || (cache && this._isMounted) ? propChildren : null; if (children) { let child = Children.only(children); - if (typeof child.type === 'function') { + // if chlild is a functional component wrap in a component to allow a ref to be set + if ( + typeof child.type === 'function' && + !(child.type.prototype instanceof Component) + ) { child =
{child}
; } const childClazz = classnames({