(type)
| 1477 | } |
| 1478 | |
| 1479 | function getComponentName(type) { |
| 1480 | if (type == null) { |
| 1481 | // Host root, text node or just invalid type. |
| 1482 | return null; |
| 1483 | } |
| 1484 | |
| 1485 | { |
| 1486 | if (typeof type.tag === 'number') { |
| 1487 | error('Received an unexpected object in getComponentName(). ' + 'This is likely a bug in React. Please file an issue.'); |
| 1488 | } |
| 1489 | } |
| 1490 | |
| 1491 | if (typeof type === 'function') { |
| 1492 | return type.displayName || type.name || null; |
| 1493 | } |
| 1494 | |
| 1495 | if (typeof type === 'string') { |
| 1496 | return type; |
| 1497 | } |
| 1498 | |
| 1499 | switch (type) { |
| 1500 | case REACT_FRAGMENT_TYPE: |
| 1501 | return 'Fragment'; |
| 1502 | |
| 1503 | case REACT_PORTAL_TYPE: |
| 1504 | return 'Portal'; |
| 1505 | |
| 1506 | case REACT_PROFILER_TYPE: |
| 1507 | return "Profiler"; |
| 1508 | |
| 1509 | case REACT_STRICT_MODE_TYPE: |
| 1510 | return 'StrictMode'; |
| 1511 | |
| 1512 | case REACT_SUSPENSE_TYPE: |
| 1513 | return 'Suspense'; |
| 1514 | |
| 1515 | case REACT_SUSPENSE_LIST_TYPE: |
| 1516 | return 'SuspenseList'; |
| 1517 | } |
| 1518 | |
| 1519 | if (typeof type === 'object') { |
| 1520 | switch (type.$$typeof) { |
| 1521 | case REACT_CONTEXT_TYPE: |
| 1522 | return 'Context.Consumer'; |
| 1523 | |
| 1524 | case REACT_PROVIDER_TYPE: |
| 1525 | return 'Context.Provider'; |
| 1526 | |
| 1527 | case REACT_FORWARD_REF_TYPE: |
| 1528 | return getWrappedName(type, type.render, 'ForwardRef'); |
| 1529 | |
| 1530 | case REACT_MEMO_TYPE: |
| 1531 | return getComponentName(type.type); |
| 1532 | |
| 1533 | case REACT_BLOCK_TYPE: |
| 1534 | return getComponentName(type.render); |
| 1535 | |
| 1536 | case REACT_LAZY_TYPE: |
no test coverage detected