(returnFiber, current, element)
| 8164 | var isArray$1 = Array.isArray; |
| 8165 | |
| 8166 | function coerceRef(returnFiber, current, element) { |
| 8167 | var mixedRef = element.ref; |
| 8168 | if (mixedRef !== null && typeof mixedRef !== 'function' && typeof mixedRef !== 'object') { |
| 8169 | { |
| 8170 | if (returnFiber.mode & StrictMode) { |
| 8171 | var componentName = getComponentName(returnFiber) || 'Component'; |
| 8172 | if (!didWarnAboutStringRefInStrictMode[componentName]) { |
| 8173 | 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)); |
| 8174 | didWarnAboutStringRefInStrictMode[componentName] = true; |
| 8175 | } |
| 8176 | } |
| 8177 | } |
| 8178 | |
| 8179 | if (element._owner) { |
| 8180 | var owner = element._owner; |
| 8181 | var inst = void 0; |
| 8182 | if (owner) { |
| 8183 | var ownerFiber = owner; |
| 8184 | !(ownerFiber.tag === ClassComponent) ? invariant(false, 'Stateless function components cannot have refs.') : void 0; |
| 8185 | inst = ownerFiber.stateNode; |
| 8186 | } |
| 8187 | !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; |
| 8188 | var stringRef = '' + mixedRef; |
| 8189 | // Check if previous string ref matches new string ref |
| 8190 | if (current !== null && current.ref !== null && current.ref._stringRef === stringRef) { |
| 8191 | return current.ref; |
| 8192 | } |
| 8193 | var ref = function (value) { |
| 8194 | var refs = inst.refs === emptyObject ? inst.refs = {} : inst.refs; |
| 8195 | if (value === null) { |
| 8196 | delete refs[stringRef]; |
| 8197 | } else { |
| 8198 | refs[stringRef] = value; |
| 8199 | } |
| 8200 | }; |
| 8201 | ref._stringRef = stringRef; |
| 8202 | return ref; |
| 8203 | } else { |
| 8204 | !(typeof mixedRef === 'string') ? invariant(false, 'Expected ref to be a function or a string.') : void 0; |
| 8205 | !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; |
| 8206 | } |
| 8207 | } |
| 8208 | return mixedRef; |
| 8209 | } |
| 8210 | |
| 8211 | function throwOnInvalidObjectType(returnFiber, newChild) { |
| 8212 | if (returnFiber.type !== 'textarea') { |
no test coverage detected