(ctor)
| 1399 | } |
| 1400 | |
| 1401 | function lazy(ctor) { |
| 1402 | var payload = { |
| 1403 | // We use these fields to store the result. |
| 1404 | _status: Uninitialized, |
| 1405 | _result: ctor |
| 1406 | }; |
| 1407 | var lazyType = { |
| 1408 | $$typeof: REACT_LAZY_TYPE, |
| 1409 | _payload: payload, |
| 1410 | _init: lazyInitializer |
| 1411 | }; |
| 1412 | |
| 1413 | { |
| 1414 | // In production, this would just set it on the object. |
| 1415 | var defaultProps; |
| 1416 | var propTypes; // $FlowFixMe |
| 1417 | |
| 1418 | Object.defineProperties(lazyType, { |
| 1419 | defaultProps: { |
| 1420 | configurable: true, |
| 1421 | get: function () { |
| 1422 | return defaultProps; |
| 1423 | }, |
| 1424 | set: function (newDefaultProps) { |
| 1425 | error('React.lazy(...): It is not supported to assign `defaultProps` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); |
| 1426 | |
| 1427 | defaultProps = newDefaultProps; // Match production behavior more closely: |
| 1428 | // $FlowFixMe |
| 1429 | |
| 1430 | Object.defineProperty(lazyType, 'defaultProps', { |
| 1431 | enumerable: true |
| 1432 | }); |
| 1433 | } |
| 1434 | }, |
| 1435 | propTypes: { |
| 1436 | configurable: true, |
| 1437 | get: function () { |
| 1438 | return propTypes; |
| 1439 | }, |
| 1440 | set: function (newPropTypes) { |
| 1441 | error('React.lazy(...): It is not supported to assign `propTypes` to ' + 'a lazy component import. Either specify them where the component ' + 'is defined, or create a wrapping component around it.'); |
| 1442 | |
| 1443 | propTypes = newPropTypes; // Match production behavior more closely: |
| 1444 | // $FlowFixMe |
| 1445 | |
| 1446 | Object.defineProperty(lazyType, 'propTypes', { |
| 1447 | enumerable: true |
| 1448 | }); |
| 1449 | } |
| 1450 | } |
| 1451 | }); |
| 1452 | } |
| 1453 | |
| 1454 | return lazyType; |
| 1455 | } |
| 1456 | |
| 1457 | function forwardRef(render) { |
| 1458 | { |
no test coverage detected
searching dependent graphs…