(fiber, type, parentContext)
| 14487 | } |
| 14488 | |
| 14489 | function processChildContext(fiber, type, parentContext) { |
| 14490 | { |
| 14491 | var instance = fiber.stateNode; |
| 14492 | var childContextTypes = type.childContextTypes; // TODO (bvaughn) Replace this behavior with an invariant() in the future. |
| 14493 | // It has only been added in Fiber to match the (unintentional) behavior in Stack. |
| 14494 | |
| 14495 | if (typeof instance.getChildContext !== 'function') { |
| 14496 | { |
| 14497 | var componentName = getComponentName(type) || 'Unknown'; |
| 14498 | |
| 14499 | if (!warnedAboutMissingGetChildContext[componentName]) { |
| 14500 | warnedAboutMissingGetChildContext[componentName] = true; |
| 14501 | |
| 14502 | error('%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); |
| 14503 | } |
| 14504 | } |
| 14505 | |
| 14506 | return parentContext; |
| 14507 | } |
| 14508 | |
| 14509 | var childContext; |
| 14510 | startPhaseTimer(fiber, 'getChildContext'); |
| 14511 | childContext = instance.getChildContext(); |
| 14512 | stopPhaseTimer(); |
| 14513 | |
| 14514 | for (var contextKey in childContext) { |
| 14515 | if (!(contextKey in childContextTypes)) { |
| 14516 | { |
| 14517 | throw Error( (getComponentName(type) || 'Unknown') + ".getChildContext(): key \"" + contextKey + "\" is not defined in childContextTypes." ); |
| 14518 | } |
| 14519 | } |
| 14520 | } |
| 14521 | |
| 14522 | { |
| 14523 | var name = getComponentName(type) || 'Unknown'; |
| 14524 | checkPropTypes(childContextTypes, childContext, 'child context', name, // In practice, there is one case in which we won't get a stack. It's when |
| 14525 | // somebody calls unstable_renderSubtreeIntoContainer() and we process |
| 14526 | // context from the parent component instance. The stack will be missing |
| 14527 | // because it's outside of the reconciliation, and so the pointer has not |
| 14528 | // been set. This is rare and doesn't matter. We'll also remove that API. |
| 14529 | getCurrentFiberStackInDev); |
| 14530 | } |
| 14531 | |
| 14532 | return _assign({}, parentContext, {}, childContext); |
| 14533 | } |
| 14534 | } |
| 14535 | |
| 14536 | function pushContextProvider(workInProgress) { |
| 14537 | { |
no test coverage detected