(parentComponent, children, container, forceHydrate, callback)
| 18074 | } |
| 18075 | |
| 18076 | function legacyRenderSubtreeIntoContainer(parentComponent, children, container, forceHydrate, callback) { |
| 18077 | // TODO: Ensure all entry points contain this check |
| 18078 | !isValidContainer(container) ? invariant(false, 'Target container is not a DOM element.') : void 0; |
| 18079 | |
| 18080 | { |
| 18081 | topLevelUpdateWarnings(container); |
| 18082 | } |
| 18083 | |
| 18084 | // TODO: Without `any` type, Flow says "Property cannot be accessed on any |
| 18085 | // member of intersection type." Whyyyyyy. |
| 18086 | var root = container._reactRootContainer; |
| 18087 | if (!root) { |
| 18088 | // Initial mount |
| 18089 | root = container._reactRootContainer = legacyCreateRootFromDOMContainer(container, forceHydrate); |
| 18090 | if (typeof callback === 'function') { |
| 18091 | var originalCallback = callback; |
| 18092 | callback = function () { |
| 18093 | var instance = DOMRenderer.getPublicRootInstance(root._internalRoot); |
| 18094 | originalCallback.call(instance); |
| 18095 | }; |
| 18096 | } |
| 18097 | // Initial mount should not be batched. |
| 18098 | DOMRenderer.unbatchedUpdates(function () { |
| 18099 | if (parentComponent != null) { |
| 18100 | root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback); |
| 18101 | } else { |
| 18102 | root.render(children, callback); |
| 18103 | } |
| 18104 | }); |
| 18105 | } else { |
| 18106 | if (typeof callback === 'function') { |
| 18107 | var _originalCallback = callback; |
| 18108 | callback = function () { |
| 18109 | var instance = DOMRenderer.getPublicRootInstance(root._internalRoot); |
| 18110 | _originalCallback.call(instance); |
| 18111 | }; |
| 18112 | } |
| 18113 | // Update |
| 18114 | if (parentComponent != null) { |
| 18115 | root.legacy_renderSubtreeIntoContainer(parentComponent, children, callback); |
| 18116 | } else { |
| 18117 | root.render(children, callback); |
| 18118 | } |
| 18119 | } |
| 18120 | return DOMRenderer.getPublicRootInstance(root._internalRoot); |
| 18121 | } |
| 18122 | |
| 18123 | function createPortal(children, container) { |
| 18124 | var key = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null; |
no test coverage detected