Skip to content

Commit

Permalink
fix(Overlay): check if instance of React Component
Browse files Browse the repository at this point in the history
  • Loading branch information
jdkahn committed Jun 21, 2019
1 parent cff7566 commit c9e6802
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/overlay/overlay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = <div role="none">{child}</div>;
}
const childClazz = classnames({
Expand Down

0 comments on commit c9e6802

Please sign in to comment.