(current, workInProgress, renderExpirationTime)
| 10119 | } |
| 10120 | |
| 10121 | function mountIndeterminateComponent(current, workInProgress, renderExpirationTime) { |
| 10122 | !(current === null) ? invariant(false, 'An indeterminate component should never have mounted. This error is likely caused by a bug in React. Please file an issue.') : void 0; |
| 10123 | var fn = workInProgress.type; |
| 10124 | var props = workInProgress.pendingProps; |
| 10125 | var unmaskedContext = getUnmaskedContext(workInProgress); |
| 10126 | var context = getMaskedContext(workInProgress, unmaskedContext); |
| 10127 | |
| 10128 | var value = void 0; |
| 10129 | |
| 10130 | { |
| 10131 | if (fn.prototype && typeof fn.prototype.render === 'function') { |
| 10132 | var componentName = getComponentName(workInProgress) || 'Unknown'; |
| 10133 | |
| 10134 | if (!didWarnAboutBadClass[componentName]) { |
| 10135 | warning(false, "The <%s /> component appears to have a render method, but doesn't extend React.Component. " + 'This is likely to cause errors. Change %s to extend React.Component instead.', componentName, componentName); |
| 10136 | didWarnAboutBadClass[componentName] = true; |
| 10137 | } |
| 10138 | } |
| 10139 | ReactCurrentOwner.current = workInProgress; |
| 10140 | value = fn(props, context); |
| 10141 | } |
| 10142 | // React DevTools reads this flag. |
| 10143 | workInProgress.effectTag |= PerformedWork; |
| 10144 | |
| 10145 | if (typeof value === 'object' && value !== null && typeof value.render === 'function' && value.$$typeof === undefined) { |
| 10146 | var Component = workInProgress.type; |
| 10147 | |
| 10148 | // Proceed under the assumption that this is a class instance |
| 10149 | workInProgress.tag = ClassComponent; |
| 10150 | |
| 10151 | workInProgress.memoizedState = value.state !== null && value.state !== undefined ? value.state : null; |
| 10152 | |
| 10153 | if (typeof Component.getDerivedStateFromProps === 'function') { |
| 10154 | var partialState = callGetDerivedStateFromProps(workInProgress, value, props, workInProgress.memoizedState); |
| 10155 | |
| 10156 | if (partialState !== null && partialState !== undefined) { |
| 10157 | workInProgress.memoizedState = _assign({}, workInProgress.memoizedState, partialState); |
| 10158 | } |
| 10159 | } |
| 10160 | |
| 10161 | // Push context providers early to prevent context stack mismatches. |
| 10162 | // During mounting we don't know the child context yet as the instance doesn't exist. |
| 10163 | // We will invalidate the child context in finishClassComponent() right after rendering. |
| 10164 | var hasContext = pushLegacyContextProvider(workInProgress); |
| 10165 | adoptClassInstance(workInProgress, value); |
| 10166 | mountClassInstance(workInProgress, renderExpirationTime); |
| 10167 | return finishClassComponent(current, workInProgress, true, hasContext, false, renderExpirationTime); |
| 10168 | } else { |
| 10169 | // Proceed under the assumption that this is a functional component |
| 10170 | workInProgress.tag = FunctionalComponent; |
| 10171 | { |
| 10172 | var _Component = workInProgress.type; |
| 10173 | |
| 10174 | if (_Component) { |
| 10175 | warning(!_Component.childContextTypes, '%s(...): childContextTypes cannot be defined on a functional component.', _Component.displayName || _Component.name || 'Component'); |
| 10176 | } |
| 10177 | if (workInProgress.ref !== null) { |
| 10178 | var info = ''; |
no test coverage detected