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