MCPcopy Create free account
hub / github.com/callstack/agent-device / findNearestScrollableAncestor

Function findNearestScrollableAncestor

src/utils/scroll-edge-state.ts:211–226  ·  view source on GitHub ↗
(
  nodeIndex: number | undefined,
  byIndex: Map<number, SnapshotNode>,
)

Source from the content-addressed store, hash-verified

209}
210
211function findNearestScrollableAncestor(
212 nodeIndex: number | undefined,
213 byIndex: Map<number, SnapshotNode>,
214): SnapshotNode | null {
215 if (nodeIndex === undefined) {
216 return null;
217 }
218 let node = byIndex.get(nodeIndex);
219 while (node) {
220 if (isScrollableNodeLike(node) && isUsableRect(node.rect)) {
221 return node;
222 }
223 node = node.parentIndex === undefined ? undefined : byIndex.get(node.parentIndex);
224 }
225 return null;
226}
227
228function collectSubtreeNodes(nodes: SnapshotNode[], rootIndex: number): SnapshotNode[] {
229 const byIndex = new Map(nodes.map((node) => [node.index, node]));

Callers 1

selectScrollContainerFunction · 0.85

Calls 3

isScrollableNodeLikeFunction · 0.90
getMethod · 0.80
isUsableRectFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…