(finishedWork)
| 11793 | } |
| 11794 | |
| 11795 | function commitPlacement(finishedWork) { |
| 11796 | // Recursively insert all host nodes into the parent. |
| 11797 | var parentFiber = getHostParentFiber(finishedWork); |
| 11798 | var parent = void 0; |
| 11799 | var isContainer = void 0; |
| 11800 | switch (parentFiber.tag) { |
| 11801 | case HostComponent: |
| 11802 | parent = parentFiber.stateNode; |
| 11803 | isContainer = false; |
| 11804 | break; |
| 11805 | case HostRoot: |
| 11806 | parent = parentFiber.stateNode.containerInfo; |
| 11807 | isContainer = true; |
| 11808 | break; |
| 11809 | case HostPortal: |
| 11810 | parent = parentFiber.stateNode.containerInfo; |
| 11811 | isContainer = true; |
| 11812 | break; |
| 11813 | default: |
| 11814 | invariant(false, 'Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.'); |
| 11815 | } |
| 11816 | if (parentFiber.effectTag & ContentReset) { |
| 11817 | // Reset the text content of the parent before doing any insertions |
| 11818 | resetTextContent(parent); |
| 11819 | // Clear ContentReset from the effect tag |
| 11820 | parentFiber.effectTag &= ~ContentReset; |
| 11821 | } |
| 11822 | |
| 11823 | var before = getHostSibling(finishedWork); |
| 11824 | // We only have the top Fiber that was inserted but we need recurse down its |
| 11825 | // children to find all the terminal nodes. |
| 11826 | var node = finishedWork; |
| 11827 | while (true) { |
| 11828 | if (node.tag === HostComponent || node.tag === HostText) { |
| 11829 | if (before) { |
| 11830 | if (isContainer) { |
| 11831 | insertInContainerBefore(parent, node.stateNode, before); |
| 11832 | } else { |
| 11833 | insertBefore(parent, node.stateNode, before); |
| 11834 | } |
| 11835 | } else { |
| 11836 | if (isContainer) { |
| 11837 | appendChildToContainer(parent, node.stateNode); |
| 11838 | } else { |
| 11839 | appendChild(parent, node.stateNode); |
| 11840 | } |
| 11841 | } |
| 11842 | } else if (node.tag === HostPortal) { |
| 11843 | // If the insertion itself is a portal, then we don't want to traverse |
| 11844 | // down its children. Instead, we'll get insertions from each child in |
| 11845 | // the portal directly. |
| 11846 | } else if (node.child !== null) { |
| 11847 | node.child['return'] = node; |
| 11848 | node = node.child; |
| 11849 | continue; |
| 11850 | } |
| 11851 | if (node === finishedWork) { |
| 11852 | return; |
no test coverage detected