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

Function unwrapScrollableContentRoot

src/platforms/android/scroll-hints.ts:231–250  ·  view source on GitHub ↗
(
  nodes: RawSnapshotNode[],
  scrollNode: RawSnapshotNode,
)

Source from the content-addressed store, hash-verified

229}
230
231function unwrapScrollableContentRoot(
232 nodes: RawSnapshotNode[],
233 scrollNode: RawSnapshotNode,
234): RawSnapshotNode {
235 let current = scrollNode;
236 const visited = new Set<number>();
237 while (!visited.has(current.index)) {
238 visited.add(current.index);
239 const children = nodes.filter((node) => node.parentIndex === current.index && node.rect);
240 if (children.length !== 1) {
241 return current;
242 }
243 const child = children[0] as RawSnapshotNode & { rect: Rect };
244 if (!sameRect(child.rect, scrollNode.rect as Rect)) {
245 return current;
246 }
247 current = child;
248 }
249 return scrollNode;
250}
251
252function collectNativeScrollViews(root: ViewNode): NativeScrollView[] {
253 const results: NativeScrollView[] = [];

Callers 1

collectVisibleFlowBlocksFunction · 0.85

Calls 1

sameRectFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…