Fix isClassComponent function (#1571)

`Object.getPrototypeOf(component)` returns React `function Component()` function itself, not `Component.prototype`.
This commit is contained in:
Andrey Ivlev
2019-10-07 12:17:22 -06:00
committed by Tanner Linsley
parent cbb18368b2
commit 7c73a7a631
+4 -1
View File
@@ -288,7 +288,10 @@ export function flexRender(Comp, props) {
function isClassComponent(component) {
return (
typeof component === 'function' &&
!!Object.getPrototypeOf(component).isReactComponent
!!(() => {
let proto = Object.getPrototypeOf(component)
return proto.prototype && proto.prototype.isReactComponent
})()
)
}