@@ -14,7 +14,7 @@ import type {ReactProvider, ReactContext} from 'shared/ReactTypes';
14
14
15
15
import * as React from 'react' ;
16
16
import invariant from 'shared/invariant' ;
17
- import getComponentName from 'shared/getComponentName ' ;
17
+ import getComponentNameFromType from 'shared/getComponentNameFromType ' ;
18
18
import { describeUnknownElementTypeFrameInDEV } from 'shared/ReactComponentStackFrame' ;
19
19
import ReactSharedInternals from 'shared/ReactSharedInternals' ;
20
20
import {
@@ -259,7 +259,7 @@ function warnNoop(
259
259
if ( __DEV__ ) {
260
260
const constructor = publicInstance . constructor ;
261
261
const componentName =
262
- ( constructor && getComponentName ( constructor ) ) || 'ReactClass' ;
262
+ ( constructor && getComponentNameFromType ( constructor ) ) || 'ReactClass' ;
263
263
const warningKey = componentName + '.' + callerName ;
264
264
if ( didWarnAboutNoopUpdateForComponent [ warningKey ] ) {
265
265
return ;
@@ -404,7 +404,7 @@ function validateRenderResult(child, type) {
404
404
'%s(...): Nothing was returned from render. This usually means a ' +
405
405
'return statement is missing. Or, to render nothing, ' +
406
406
'return null.' ,
407
- getComponentName ( type ) || 'Component' ,
407
+ getComponentNameFromType ( type ) || 'Component' ,
408
408
) ;
409
409
}
410
410
}
@@ -467,7 +467,8 @@ function resolve(
467
467
if ( typeof Component . getDerivedStateFromProps === 'function' ) {
468
468
if ( __DEV__ ) {
469
469
if ( inst . state === null || inst . state === undefined ) {
470
- const componentName = getComponentName ( Component ) || 'Unknown' ;
470
+ const componentName =
471
+ getComponentNameFromType ( Component ) || 'Unknown' ;
471
472
if ( ! didWarnAboutUninitializedState [ componentName ] ) {
472
473
console . error (
473
474
'`%s` uses `getDerivedStateFromProps` but its initial state is ' +
@@ -491,7 +492,8 @@ function resolve(
491
492
492
493
if ( __DEV__ ) {
493
494
if ( partialState === undefined ) {
494
- const componentName = getComponentName ( Component ) || 'Unknown' ;
495
+ const componentName =
496
+ getComponentNameFromType ( Component ) || 'Unknown' ;
495
497
if ( ! didWarnAboutUndefinedDerivedState [ componentName ] ) {
496
498
console . error (
497
499
'%s.getDerivedStateFromProps(): A valid state object (or null) must be returned. ' +
@@ -513,7 +515,8 @@ function resolve(
513
515
Component . prototype &&
514
516
typeof Component . prototype . render === 'function'
515
517
) {
516
- const componentName = getComponentName ( Component ) || 'Unknown' ;
518
+ const componentName =
519
+ getComponentNameFromType ( Component ) || 'Unknown' ;
517
520
518
521
if ( ! didWarnAboutBadClass [ componentName ] ) {
519
522
console . error (
@@ -535,7 +538,8 @@ function resolve(
535
538
// Support for module components is deprecated and is removed behind a flag.
536
539
// Whether or not it would crash later, we want to show a good message in DEV first.
537
540
if ( inst != null && inst . render != null ) {
538
- const componentName = getComponentName ( Component ) || 'Unknown' ;
541
+ const componentName =
542
+ getComponentNameFromType ( Component ) || 'Unknown' ;
539
543
if ( ! didWarnAboutModulePatternComponent [ componentName ] ) {
540
544
console . error (
541
545
'The <%s /> component appears to be a function component that returns a class instance. ' +
@@ -583,7 +587,8 @@ function resolve(
583
587
warnAboutDeprecatedLifecycles &&
584
588
inst . componentWillMount . __suppressDeprecationWarning !== true
585
589
) {
586
- const componentName = getComponentName ( Component ) || 'Unknown' ;
590
+ const componentName =
591
+ getComponentNameFromType ( Component ) || 'Unknown' ;
587
592
588
593
if ( ! didWarnAboutDeprecatedWillMount [ componentName ] ) {
589
594
console . warn (
@@ -665,7 +670,7 @@ function resolve(
665
670
console . error (
666
671
'%s uses the legacy childContextTypes API which is no longer supported. ' +
667
672
'Use React.createContext() instead.' ,
668
- getComponentName ( Component ) || 'Unknown' ,
673
+ getComponentNameFromType ( Component ) || 'Unknown' ,
669
674
) ;
670
675
}
671
676
}
@@ -678,7 +683,7 @@ function resolve(
678
683
invariant (
679
684
contextKey in childContextTypes ,
680
685
'%s.getChildContext(): key "%s" is not defined in childContextTypes.' ,
681
- getComponentName ( Component ) || 'Unknown' ,
686
+ getComponentNameFromType ( Component ) || 'Unknown' ,
682
687
contextKey ,
683
688
) ;
684
689
}
@@ -687,7 +692,7 @@ function resolve(
687
692
console . error (
688
693
'%s.getChildContext(): childContextTypes must be defined in order to ' +
689
694
'use getChildContext().' ,
690
- getComponentName ( Component ) || 'Unknown' ,
695
+ getComponentNameFromType ( Component ) || 'Unknown' ,
691
696
) ;
692
697
}
693
698
}
@@ -1298,7 +1303,7 @@ class ReactDOMServerRenderer {
1298
1303
"it's defined in, or you might have mixed up default and " +
1299
1304
'named imports.' ;
1300
1305
}
1301
- const ownerName = owner ? getComponentName ( owner ) : null ;
1306
+ const ownerName = owner ? getComponentNameFromType ( owner ) : null ;
1302
1307
if ( ownerName ) {
1303
1308
info += '\n\nCheck the render method of `' + ownerName + '`.' ;
1304
1309
}
0 commit comments