( nodes: RawSnapshotNode[], scrollNode: RawSnapshotNode, )
| 229 | } |
| 230 | |
| 231 | function 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 | |
| 252 | function collectNativeScrollViews(root: ViewNode): NativeScrollView[] { |
| 253 | const results: NativeScrollView[] = []; |
no test coverage detected
searching dependent graphs…