UNPKG

1.11 kBJavaScriptView Raw
1"use strict";
2var __importStar = (this && this.__importStar) || function (mod) {
3 if (mod && mod.__esModule) return mod;
4 var result = {};
5 if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
6 result["default"] = mod;
7 return result;
8};
9Object.defineProperty(exports, "__esModule", { value: true });
10const react_1 = __importStar(require("react"));
11const context_1 = require("./context");
12class DialogConsumer extends react_1.Component {
13 render() {
14 return (react_1.default.createElement(context_1.DialogContext.Consumer, null, context => {
15 const props = Object.assign({}, context);
16 const { children } = this.props;
17 const elements = [];
18 react_1.default.Children.forEach(children, child => {
19 if (react_1.default.isValidElement(child)) {
20 elements.push(react_1.default.cloneElement(child, props));
21 }
22 });
23 return elements || null;
24 }));
25 }
26}
27exports.default = DialogConsumer;
28//# sourceMappingURL=consumer.js.map
\No newline at end of file