diff --git a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js index 7db34eafa700a..115544170a83e 100644 --- a/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js +++ b/packages/react-dom/src/__tests__/ReactCompositeComponent-test.js @@ -1762,4 +1762,18 @@ describe('ReactCompositeComponent', () => { {withoutStack: true}, ); }); + + // Regression test for accidental breaking change + // https://github.com/facebook/react/issues/13580 + it('should support classes shadowing isReactComponent', () => { + class Shadow extends React.Component { + isReactComponent() {} + render() { + return
; + } + } + const container = document.createElement('div'); + ReactDOM.render(, container); + expect(container.firstChild.tagName).toBe('DIV'); + }); }); diff --git a/packages/react-reconciler/src/ReactFiber.js b/packages/react-reconciler/src/ReactFiber.js index 5fba962eed60a..5ba88f0011c95 100644 --- a/packages/react-reconciler/src/ReactFiber.js +++ b/packages/react-reconciler/src/ReactFiber.js @@ -284,12 +284,7 @@ const createFiber = function( function shouldConstruct(Component: Function) { const prototype = Component.prototype; - return ( - typeof prototype === 'object' && - prototype !== null && - typeof prototype.isReactComponent === 'object' && - prototype.isReactComponent !== null - ); + return !!(prototype && prototype.isReactComponent); } export function resolveLazyComponentTag(