( request: Request, task: Task, keyPath: KeyNode, context: ReactContext<any>, props: Object, )
| 2727 | } |
| 2728 | |
| 2729 | function renderContextConsumer( |
| 2730 | request: Request, |
| 2731 | task: Task, |
| 2732 | keyPath: KeyNode, |
| 2733 | context: ReactContext<any>, |
| 2734 | props: Object, |
| 2735 | ): void { |
| 2736 | const render = props.children; |
| 2737 | |
| 2738 | if (__DEV__) { |
| 2739 | if (typeof render !== 'function') { |
| 2740 | console.error( |
| 2741 | 'A context consumer was rendered with multiple children, or a child ' + |
| 2742 | "that isn't a function. A context consumer expects a single child " + |
| 2743 | 'that is a function. If you did pass a function, make sure there ' + |
| 2744 | 'is no trailing or leading whitespace around it.', |
| 2745 | ); |
| 2746 | } |
| 2747 | } |
| 2748 | |
| 2749 | const newValue = readContext(context); |
| 2750 | const newChildren = render(newValue); |
| 2751 | |
| 2752 | const prevKeyPath = task.keyPath; |
| 2753 | task.keyPath = keyPath; |
| 2754 | renderNodeDestructive(request, task, newChildren, -1); |
| 2755 | task.keyPath = prevKeyPath; |
| 2756 | } |
| 2757 | |
| 2758 | function renderContextProvider( |
| 2759 | request: Request, |
no test coverage detected