(node: ViewNode)
| 266 | } |
| 267 | |
| 268 | function toNativeScrollView(node: ViewNode): NativeScrollView | null { |
| 269 | const contentRoot = node.children[0]; |
| 270 | if (!contentRoot) { |
| 271 | return null; |
| 272 | } |
| 273 | const contentExtent = Math.max( |
| 274 | contentRoot.rect.height, |
| 275 | ...contentRoot.children.map((child) => child.rect.y + child.rect.height), |
| 276 | ); |
| 277 | const contentBlocks = contentRoot.children |
| 278 | .filter((child) => hasPositiveVerticalExtent(child.rect)) |
| 279 | .map((child) => toFlowBlock(child.rect, node.rect)) |
| 280 | .sort((left, right) => left.start - right.start); |
| 281 | if (contentBlocks.length === 0) { |
| 282 | return null; |
| 283 | } |
| 284 | return { |
| 285 | rect: node.rect, |
| 286 | contentExtent, |
| 287 | contentBlocks, |
| 288 | }; |
| 289 | } |
| 290 | |
| 291 | function matchNativeScrollView( |
| 292 | rect: Rect, |
no test coverage detected
searching dependent graphs…