(returnFiber, current, element)
| 8933 | var isArray$1 = Array.isArray; |
| 8934 | |
| 8935 | function coerceRef(returnFiber, current, element) { |
| 8936 | var mixedRef = element.ref; |
| 8937 | if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') { |
| 8938 | { |
| 8939 | if (returnFiber.mode & StrictMode) { |
| 8940 | var componentName = getComponentName(returnFiber) || 'Component'; |
| 8941 | if (!didWarnAboutStringRefInStrictMode[componentName]) { |
| 8942 | warning(false, 'A string ref, "%s", has been found within a strict mode tree. ' + 'String refs are a source of potential bugs and should be avoided. ' + 'We recommend using createRef() instead.' + '\n%s' + '\n\nLearn more about using refs safely here:' + '\nhttps://fb.me/react-strict-mode-string-ref', mixedRef, getStackAddendumByWorkInProgressFiber(returnFiber)); |
| 8943 | didWarnAboutStringRefInStrictMode[componentName] = true; |
| 8944 | } |
| 8945 | } |
| 8946 | } |
| 8947 | |
| 8948 | if (element._owner) { |
| 8949 | var owner = element._owner; |
| 8950 | var inst = void 0; |
| 8951 | if (owner) { |
| 8952 | var ownerFiber = owner; |
| 8953 | !(ownerFiber.tag === ClassComponent) ? invariant(false, 'Stateless function components cannot have refs.') : void 0; |
| 8954 | inst = ownerFiber.stateNode; |
| 8955 | } |
| 8956 | !inst ? invariant(false, 'Missing owner for string ref %s. This error is likely caused by a bug in React. Please file an issue.', mixedRef) : void 0; |
| 8957 | var stringRef = '' + mixedRef; |
| 8958 | // Check if previous string ref matches new string ref |
| 8959 | if (current !== null && current.ref !== null && current.ref._stringRef === stringRef) { |
| 8960 | return current.ref; |
| 8961 | } |
| 8962 | var ref = function (value) { |
| 8963 | var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs; |
| 8964 | if (value === null) { |
| 8965 | delete refs[stringRef]; |
| 8966 | } else { |
| 8967 | refs[stringRef] = value; |
| 8968 | } |
| 8969 | }; |
| 8970 | ref._stringRef = stringRef; |
| 8971 | return ref; |
| 8972 | } else { |
| 8973 | !(typeof mixedRef === 'string') ? invariant(false, 'Expected ref to be a function or a string.') : void 0; |
| 8974 | !element._owner ? invariant(false, 'Element ref was specified as a string (%s) but no owner was set. This could happen for one of the following reasons:\n1. You may be adding a ref to a functional component\n2. You may be adding a ref to a component that was not created inside a component\'s render method\n3. You have multiple copies of React loaded\nSee https://fb.me/react-refs-must-have-owner for more information.', mixedRef) : void 0; |
| 8975 | } |
| 8976 | } |
| 8977 | return mixedRef; |
| 8978 | } |
| 8979 | |
| 8980 | function throwOnInvalidObjectType(returnFiber, newChild) { |
| 8981 | if (returnFiber.type !== 'textarea') { |
no test coverage detected