(finishedWork)
| 11655 | } |
| 11656 | |
| 11657 | function commitPlacement(finishedWork) { |
| 11658 | // Recursively insert all host nodes into the parent. |
| 11659 | var parentFiber = getHostParentFiber(finishedWork); |
| 11660 | var parent = void 0; |
| 11661 | var isContainer = void 0; |
| 11662 | switch (parentFiber.tag) { |
| 11663 | case HostComponent: |
| 11664 | parent = parentFiber.stateNode; |
| 11665 | isContainer = false; |
| 11666 | break; |
| 11667 | case HostRoot: |
| 11668 | parent = parentFiber.stateNode.containerInfo; |
| 11669 | isContainer = true; |
| 11670 | break; |
| 11671 | case HostPortal: |
| 11672 | parent = parentFiber.stateNode.containerInfo; |
| 11673 | isContainer = true; |
| 11674 | break; |
| 11675 | default: |
| 11676 | invariant(false, 'Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.'); |
| 11677 | } |
| 11678 | if (parentFiber.effectTag & ContentReset) { |
| 11679 | // Reset the text content of the parent before doing any insertions |
| 11680 | resetTextContent(parent); |
| 11681 | // Clear ContentReset from the effect tag |
| 11682 | parentFiber.effectTag &= ~ContentReset; |
| 11683 | } |
| 11684 | |
| 11685 | var before = getHostSibling(finishedWork); |
| 11686 | // We only have the top Fiber that was inserted but we need recurse down its |
| 11687 | // children to find all the terminal nodes. |
| 11688 | var node = finishedWork; |
| 11689 | while (true) { |
| 11690 | if (node.tag === HostComponent || node.tag === HostText) { |
| 11691 | if (before) { |
| 11692 | if (isContainer) { |
| 11693 | insertInContainerBefore(parent, node.stateNode, before); |
| 11694 | } else { |
| 11695 | insertBefore(parent, node.stateNode, before); |
| 11696 | } |
| 11697 | } else { |
| 11698 | if (isContainer) { |
| 11699 | appendChildToContainer(parent, node.stateNode); |
| 11700 | } else { |
| 11701 | appendChild(parent, node.stateNode); |
| 11702 | } |
| 11703 | } |
| 11704 | } else if (node.tag === HostPortal) { |
| 11705 | // If the insertion itself is a portal, then we don't want to traverse |
| 11706 | // down its children. Instead, we'll get insertions from each child in |
| 11707 | // the portal directly. |
| 11708 | } else if (node.child !== null) { |
| 11709 | node.child['return'] = node; |
| 11710 | node = node.child; |
| 11711 | continue; |
| 11712 | } |
| 11713 | if (node === finishedWork) { |
| 11714 | return; |
no test coverage detected