Component -> Unknown (#8863)
Fix Flow issue and revert to showing "Unknown" in warnings for anonymous components
Edvin Erikson committed
Jan 25, 2017 at 15:49 UTC
0c7f21a705bef489f2897929910b4c74d7ddda09
1 file changed
+4
-4
src/shared/utils/getComponentName.js
+4
-4
@@ -15,11 +15,11 @@
15
import type { ReactInstance } from 'ReactInstanceType';
16
import type { Fiber } from 'ReactFiber';
17
18
-function getComponentName(instanceOrFiber : ReactInstance | Fiber) : string {
18
+function getComponentName(instanceOrFiber : ReactInstance | Fiber) : string | null {
19
if (typeof instanceOrFiber.getName === 'function') {
20
// Stack reconciler
21
const instance = ((instanceOrFiber : any) : ReactInstance);
22
- return instance.getName() || 'Component';
22
+ return instance.getName();
23
}
24
if (typeof instanceOrFiber.tag === 'number') {
25
// Fiber reconciler
@@ -29,10 +29,10 @@ function getComponentName(instanceOrFiber : ReactInstance | Fiber) : string {
29
return type;
30
}
31
if (typeof type === 'function') {
32
- return type.displayName || type.name || 'Component';
32
+ return type.displayName || type.name;
33
}
34
}
35
- return 'Component';
35
+ return null;
36
}
37
38
module.exports = getComponentName;