function commitLayoutEffects()

in Libraries/Renderer/implementations/ReactFabric-prod.js [5819:5931]


function commitLayoutEffects(finishedWork) {
  for (nextEffect = finishedWork; null !== nextEffect; ) {
    var fiber = nextEffect,
      firstChild = fiber.child;
    if (0 !== (fiber.subtreeFlags & 324) && null !== firstChild)
      (firstChild.return = fiber), (nextEffect = firstChild);
    else
      for (fiber = finishedWork; null !== nextEffect; ) {
        firstChild = nextEffect;
        if (0 !== (firstChild.flags & 324)) {
          var current = firstChild.alternate;
          try {
            if (0 !== (firstChild.flags & 68))
              switch (firstChild.tag) {
                case 0:
                case 11:
                case 15:
                  commitHookEffectListMount(3, firstChild);
                  break;
                case 1:
                  var instance = firstChild.stateNode;
                  if (firstChild.flags & 4)
                    if (null === current) instance.componentDidMount();
                    else {
                      var prevProps =
                        firstChild.elementType === firstChild.type
                          ? current.memoizedProps
                          : resolveDefaultProps(
                              firstChild.type,
                              current.memoizedProps
                            );
                      instance.componentDidUpdate(
                        prevProps,
                        current.memoizedState,
                        instance.__reactInternalSnapshotBeforeUpdate
                      );
                    }
                  var updateQueue = firstChild.updateQueue;
                  null !== updateQueue &&
                    commitUpdateQueue(firstChild, updateQueue, instance);
                  break;
                case 3:
                  var updateQueue$83 = firstChild.updateQueue;
                  if (null !== updateQueue$83) {
                    current = null;
                    if (null !== firstChild.child)
                      switch (firstChild.child.tag) {
                        case 5:
                          current = firstChild.child.stateNode.canonical;
                          break;
                        case 1:
                          current = firstChild.child.stateNode;
                      }
                    commitUpdateQueue(firstChild, updateQueue$83, current);
                  }
                  break;
                case 5:
                  null === current && firstChild.flags & 4 && shim();
                  break;
                case 6:
                  break;
                case 4:
                  break;
                case 12:
                  break;
                case 13:
                  break;
                case 19:
                case 17:
                case 21:
                case 22:
                case 23:
                  break;
                default:
                  throw Error(
                    "This unit of work tag should not have side-effects. This error is likely caused by a bug in React. Please file an issue."
                  );
              }
            if (firstChild.flags & 256) {
              current = void 0;
              var ref = firstChild.ref;
              if (null !== ref) {
                var instance$jscomp$0 = firstChild.stateNode;
                switch (firstChild.tag) {
                  case 5:
                    current = instance$jscomp$0.canonical;
                    break;
                  default:
                    current = instance$jscomp$0;
                }
                "function" === typeof ref
                  ? ref(current)
                  : (ref.current = current);
              }
            }
          } catch (error) {
            captureCommitPhaseError(firstChild, firstChild.return, error);
          }
        }
        if (firstChild === fiber) {
          nextEffect = null;
          break;
        }
        current = firstChild.sibling;
        if (null !== current) {
          current.return = firstChild.return;
          nextEffect = current;
          break;
        }
        nextEffect = firstChild.return;
      }
  }
}