(current, workInProgress, renderExpirationTime)
| 21955 | var hasWarnedAboutUsingContextAsConsumer = false; |
| 21956 | |
| 21957 | function updateContextConsumer(current, workInProgress, renderExpirationTime) { |
| 21958 | var context = workInProgress.type; // The logic below for Context differs depending on PROD or DEV mode. In |
| 21959 | // DEV mode, we create a separate object for Context.Consumer that acts |
| 21960 | // like a proxy to Context. This proxy object adds unnecessary code in PROD |
| 21961 | // so we use the old behaviour (Context.Consumer references Context) to |
| 21962 | // reduce size and overhead. The separate object references context via |
| 21963 | // a property called "_context", which also gives us the ability to check |
| 21964 | // in DEV mode if this property exists or not and warn if it does not. |
| 21965 | |
| 21966 | { |
| 21967 | if (context._context === undefined) { |
| 21968 | // This may be because it's a Context (rather than a Consumer). |
| 21969 | // Or it may be because it's older React where they're the same thing. |
| 21970 | // We only want to warn if we're sure it's a new React. |
| 21971 | if (context !== context.Consumer) { |
| 21972 | if (!hasWarnedAboutUsingContextAsConsumer) { |
| 21973 | hasWarnedAboutUsingContextAsConsumer = true; |
| 21974 | |
| 21975 | error('Rendering <Context> directly is not supported and will be removed in ' + 'a future major release. Did you mean to render <Context.Consumer> instead?'); |
| 21976 | } |
| 21977 | } |
| 21978 | } else { |
| 21979 | context = context._context; |
| 21980 | } |
| 21981 | } |
| 21982 | |
| 21983 | var newProps = workInProgress.pendingProps; |
| 21984 | var render = newProps.children; |
| 21985 | |
| 21986 | { |
| 21987 | if (typeof render !== 'function') { |
| 21988 | error('A context consumer was rendered with multiple children, or a child ' + "that isn't a function. A context consumer expects a single child " + 'that is a function. If you did pass a function, make sure there ' + 'is no trailing or leading whitespace around it.'); |
| 21989 | } |
| 21990 | } |
| 21991 | |
| 21992 | prepareToReadContext(workInProgress, renderExpirationTime); |
| 21993 | var newValue = readContext(context, newProps.unstable_observedBits); |
| 21994 | var newChildren; |
| 21995 | |
| 21996 | { |
| 21997 | ReactCurrentOwner$1.current = workInProgress; |
| 21998 | setIsRendering(true); |
| 21999 | newChildren = render(newValue); |
| 22000 | setIsRendering(false); |
| 22001 | } // React DevTools reads this flag. |
| 22002 | |
| 22003 | |
| 22004 | workInProgress.effectTag |= PerformedWork; |
| 22005 | reconcileChildren(current, workInProgress, newChildren, renderExpirationTime); |
| 22006 | return workInProgress.child; |
| 22007 | } |
| 22008 | |
| 22009 | function markWorkInProgressReceivedUpdate() { |
| 22010 | didReceiveUpdate = true; |
no test coverage detected