Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions packages/react-dom/src/__tests__/ReactCompositeComponent-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 <div />;
}
}
const container = document.createElement('div');
ReactDOM.render(<Shadow />, container);
expect(container.firstChild.tagName).toBe('DIV');
});
});
7 changes: 1 addition & 6 deletions packages/react-reconciler/src/ReactFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down