mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Fix a regression related to isReactComponent prototype check (#13608)
This commit is contained in:
@@ -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');
|
||||
});
|
||||
});
|
||||
|
||||
+1
-6
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user