| 1500 | } |
| 1501 | |
| 1502 | function forwardRef(render) { |
| 1503 | { |
| 1504 | if (render != null && render.$$typeof === REACT_MEMO_TYPE) { |
| 1505 | error('forwardRef requires a render function but received a `memo` ' + 'component. Instead of forwardRef(memo(...)), use ' + 'memo(forwardRef(...)).'); |
| 1506 | } else if (typeof render !== 'function') { |
| 1507 | error('forwardRef requires a render function but was given %s.', render === null ? 'null' : typeof render); |
| 1508 | } else { |
| 1509 | if (render.length !== 0 && render.length !== 2) { |
| 1510 | error('forwardRef render functions accept exactly two parameters: props and ref. %s', render.length === 1 ? 'Did you forget to use the ref parameter?' : 'Any additional parameter will be undefined.'); |
| 1511 | } |
| 1512 | } |
| 1513 | |
| 1514 | if (render != null) { |
| 1515 | if (render.defaultProps != null || render.propTypes != null) { |
| 1516 | error('forwardRef render functions do not support propTypes or defaultProps. ' + 'Did you accidentally pass a React component?'); |
| 1517 | } |
| 1518 | } |
| 1519 | } |
| 1520 | |
| 1521 | return { |
| 1522 | $$typeof: REACT_FORWARD_REF_TYPE, |
| 1523 | render: render |
| 1524 | }; |
| 1525 | } |
| 1526 | |
| 1527 | function isValidElementType(type) { |
| 1528 | return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill. |