(fiber, parentContext)
| 11709 | } |
| 11710 | |
| 11711 | function processChildContext(fiber, parentContext) { |
| 11712 | var instance = fiber.stateNode; |
| 11713 | var childContextTypes = fiber.type.childContextTypes; |
| 11714 | |
| 11715 | // TODO (bvaughn) Replace this behavior with an invariant() in the future. |
| 11716 | // It has only been added in Fiber to match the (unintentional) behavior in Stack. |
| 11717 | if (typeof instance.getChildContext !== 'function') { |
| 11718 | { |
| 11719 | var componentName = getComponentName(fiber) || 'Unknown'; |
| 11720 | |
| 11721 | if (!warnedAboutMissingGetChildContext[componentName]) { |
| 11722 | warnedAboutMissingGetChildContext[componentName] = true; |
| 11723 | 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); |
| 11724 | } |
| 11725 | } |
| 11726 | return parentContext; |
| 11727 | } |
| 11728 | |
| 11729 | var childContext = void 0; |
| 11730 | { |
| 11731 | ReactDebugCurrentFiber.setCurrentPhase('getChildContext'); |
| 11732 | } |
| 11733 | startPhaseTimer(fiber, 'getChildContext'); |
| 11734 | childContext = instance.getChildContext(); |
| 11735 | stopPhaseTimer(); |
| 11736 | { |
| 11737 | ReactDebugCurrentFiber.setCurrentPhase(null); |
| 11738 | } |
| 11739 | for (var contextKey in childContext) { |
| 11740 | !(contextKey in childContextTypes) ? invariant(false, '%s.getChildContext(): key "%s" is not defined in childContextTypes.', getComponentName(fiber) || 'Unknown', contextKey) : void 0; |
| 11741 | } |
| 11742 | { |
| 11743 | var name = getComponentName(fiber) || 'Unknown'; |
| 11744 | checkPropTypes(childContextTypes, childContext, 'child context', name, |
| 11745 | // In practice, there is one case in which we won't get a stack. It's when |
| 11746 | // somebody calls unstable_renderSubtreeIntoContainer() and we process |
| 11747 | // context from the parent component instance. The stack will be missing |
| 11748 | // because it's outside of the reconciliation, and so the pointer has not |
| 11749 | // been set. This is rare and doesn't matter. We'll also remove that API. |
| 11750 | ReactDebugCurrentFiber.getCurrentFiberStackAddendum); |
| 11751 | } |
| 11752 | |
| 11753 | return _assign({}, parentContext, childContext); |
| 11754 | } |
| 11755 | |
| 11756 | function pushContextProvider(workInProgress) { |
| 11757 | if (!isContextProvider(workInProgress)) { |
no test coverage detected