(finishedWork)
| 10985 | } |
| 10986 | |
| 10987 | function commitPlacement(finishedWork) { |
| 10988 | // Recursively insert all host nodes into the parent. |
| 10989 | var parentFiber = getHostParentFiber(finishedWork); |
| 10990 | var parent = void 0; |
| 10991 | var isContainer = void 0; |
| 10992 | switch (parentFiber.tag) { |
| 10993 | case HostComponent: |
| 10994 | parent = parentFiber.stateNode; |
| 10995 | isContainer = false; |
| 10996 | break; |
| 10997 | case HostRoot: |
| 10998 | parent = parentFiber.stateNode.containerInfo; |
| 10999 | isContainer = true; |
| 11000 | break; |
| 11001 | case HostPortal: |
| 11002 | parent = parentFiber.stateNode.containerInfo; |
| 11003 | isContainer = true; |
| 11004 | break; |
| 11005 | default: |
| 11006 | invariant(false, 'Invalid host parent fiber. This error is likely caused by a bug in React. Please file an issue.'); |
| 11007 | } |
| 11008 | if (parentFiber.effectTag & ContentReset) { |
| 11009 | // Reset the text content of the parent before doing any insertions |
| 11010 | resetTextContent(parent); |
| 11011 | // Clear ContentReset from the effect tag |
| 11012 | parentFiber.effectTag &= ~ContentReset; |
| 11013 | } |
| 11014 | |
| 11015 | var before = getHostSibling(finishedWork); |
| 11016 | // We only have the top Fiber that was inserted but we need recurse down its |
| 11017 | // children to find all the terminal nodes. |
| 11018 | var node = finishedWork; |
| 11019 | while (true) { |
| 11020 | if (node.tag === HostComponent || node.tag === HostText) { |
| 11021 | if (before) { |
| 11022 | if (isContainer) { |
| 11023 | insertInContainerBefore(parent, node.stateNode, before); |
| 11024 | } else { |
| 11025 | insertBefore(parent, node.stateNode, before); |
| 11026 | } |
| 11027 | } else { |
| 11028 | if (isContainer) { |
| 11029 | appendChildToContainer(parent, node.stateNode); |
| 11030 | } else { |
| 11031 | appendChild(parent, node.stateNode); |
| 11032 | } |
| 11033 | } |
| 11034 | } else if (node.tag === HostPortal) { |
| 11035 | // If the insertion itself is a portal, then we don't want to traverse |
| 11036 | // down its children. Instead, we'll get insertions from each child in |
| 11037 | // the portal directly. |
| 11038 | } else if (node.child !== null) { |
| 11039 | node.child['return'] = node; |
| 11040 | node = node.child; |
| 11041 | continue; |
| 11042 | } |
| 11043 | if (node === finishedWork) { |
| 11044 | return; |
no test coverage detected