(fiber, type, parentContext)
| 10394 | } |
| 10395 | |
| 10396 | function processChildContext(fiber, type, parentContext) { |
| 10397 | var instance = fiber.stateNode; |
| 10398 | var childContextTypes = type.childContextTypes; |
| 10399 | |
| 10400 | // TODO (bvaughn) Replace this behavior with an invariant() in the future. |
| 10401 | // It has only been added in Fiber to match the (unintentional) behavior in Stack. |
| 10402 | if (typeof instance.getChildContext !== 'function') { |
| 10403 | { |
| 10404 | var componentName = getComponentName(type) || 'Unknown'; |
| 10405 | |
| 10406 | if (!warnedAboutMissingGetChildContext[componentName]) { |
| 10407 | warnedAboutMissingGetChildContext[componentName] = true; |
| 10408 | warningWithoutStack$1(false, '%s.childContextTypes is specified but there is no getChildContext() method ' + 'on the instance. You can either define getChildContext() on %s or remove ' + 'childContextTypes from it.', componentName, componentName); |
| 10409 | } |
| 10410 | } |
| 10411 | return parentContext; |
| 10412 | } |
| 10413 | |
| 10414 | var childContext = void 0; |
| 10415 | { |
| 10416 | setCurrentPhase('getChildContext'); |
| 10417 | } |
| 10418 | startPhaseTimer(fiber, 'getChildContext'); |
| 10419 | childContext = instance.getChildContext(); |
| 10420 | stopPhaseTimer(); |
| 10421 | { |
| 10422 | setCurrentPhase(null); |
| 10423 | } |
| 10424 | for (var contextKey in childContext) { |
| 10425 | !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(type) || 'Unknown', contextKey) : void 0; |
| 10426 | } |
| 10427 | { |
| 10428 | var name = getComponentName(type) || 'Unknown'; |
| 10429 | checkPropTypes(childContextTypes, childContext, 'child context', name, |
| 10430 | // In practice, there is one case in which we won't get a stack. It's when |
| 10431 | // somebody calls unstable_renderSubtreeIntoContainer() and we process |
| 10432 | // context from the parent component instance. The stack will be missing |
| 10433 | // because it's outside of the reconciliation, and so the pointer has not |
| 10434 | // been set. This is rare and doesn't matter. We'll also remove that API. |
| 10435 | getCurrentFiberStackInDev); |
| 10436 | } |
| 10437 | |
| 10438 | return _assign({}, parentContext, childContext); |
| 10439 | } |
| 10440 | |
| 10441 | function pushContextProvider(workInProgress) { |
| 10442 | var instance = workInProgress.stateNode; |
no test coverage detected