MCPcopy Create free account
hub / github.com/BetaSu/big-react / getHostSibling

Function getHostSibling

packages/react-reconciler/src/commitWork.ts:446–482  ·  view source on GitHub ↗
(fiber: FiberNode)

Source from the content-addressed store, hash-verified

444};
445
446function getHostSibling(fiber: FiberNode) {
447 let node: FiberNode = fiber;
448
449 findSibling: while (true) {
450 while (node.sibling === null) {
451 const parent = node.return;
452
453 if (
454 parent === null ||
455 parent.tag === HostComponent ||
456 parent.tag === HostRoot
457 ) {
458 return null;
459 }
460 node = parent;
461 }
462 node.sibling.return = node.return;
463 node = node.sibling;
464
465 while (node.tag !== HostText && node.tag !== HostComponent) {
466 // 向下遍历
467 if ((node.flags & Placement) !== NoFlags) {
468 continue findSibling;
469 }
470 if (node.child === null) {
471 continue findSibling;
472 } else {
473 node.child.return = node;
474 node = node.child;
475 }
476 }
477
478 if ((node.flags & Placement) === NoFlags) {
479 return node.stateNode;
480 }
481 }
482}
483
484function getHostParent(fiber: FiberNode): Container | null {
485 let parent = fiber.return;

Callers 1

commitPlacementFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected