(fiber, parentContext)
| 12414 | } |
| 12415 | |
| 12416 | function processChildContext(fiber, parentContext) { |
| 12417 | var instance = fiber.stateNode; |
| 12418 | var childContextTypes = fiber.type.childContextTypes; |
| 12419 | |
| 12420 | // TODO (bvaughn) Replace this behavior with an invariant() in the future. |
| 12421 | // It has only been added in Fiber to match the (unintentional) behavior in Stack. |
| 12422 | if (typeof instance.getChildContext !== 'function') { |
| 12423 | { |
| 12424 | var componentName = getComponentName(fiber) || 'Unknown'; |
| 12425 | |
| 12426 | if (!warnedAboutMissingGetChildContext[componentName]) { |
| 12427 | warnedAboutMissingGetChildContext[componentName] = true; |
| 12428 | warning(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); |
| 12429 | } |
| 12430 | } |
| 12431 | return parentContext; |
| 12432 | } |
| 12433 | |
| 12434 | var childContext = void 0; |
| 12435 | { |
| 12436 | ReactDebugCurrentFiber.setCurrentPhase('getChildContext'); |
| 12437 | } |
| 12438 | startPhaseTimer(fiber, 'getChildContext'); |
| 12439 | childContext = instance.getChildContext(); |
| 12440 | stopPhaseTimer(); |
| 12441 | { |
| 12442 | ReactDebugCurrentFiber.setCurrentPhase(null); |
| 12443 | } |
| 12444 | for (var contextKey in childContext) { |
| 12445 | !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(fiber) || 'Unknown', contextKey) : void 0; |
| 12446 | } |
| 12447 | { |
| 12448 | var name = getComponentName(fiber) || 'Unknown'; |
| 12449 | checkPropTypes(childContextTypes, childContext, 'child context', name, |
| 12450 | // In practice, there is one case in which we won't get a stack. It's when |
| 12451 | // somebody calls unstable_renderSubtreeIntoContainer() and we process |
| 12452 | // context from the parent component instance. The stack will be missing |
| 12453 | // because it's outside of the reconciliation, and so the pointer has not |
| 12454 | // been set. This is rare and doesn't matter. We'll also remove that API. |
| 12455 | ReactDebugCurrentFiber.getCurrentFiberStackAddendum); |
| 12456 | } |
| 12457 | |
| 12458 | return _assign({}, parentContext, childContext); |
| 12459 | } |
| 12460 | |
| 12461 | function pushContextProvider(workInProgress) { |
| 12462 | if (!isContextProvider(workInProgress)) { |
no test coverage detected