( node: Fiber, fn: ReactScopeQuery, )
| 58 | } |
| 59 | |
| 60 | function collectFirstScopedNode( |
| 61 | node: Fiber, |
| 62 | fn: ReactScopeQuery, |
| 63 | ): null | Object { |
| 64 | if (enableScopeAPI) { |
| 65 | if (node.tag === HostComponent) { |
| 66 | const {type, memoizedProps, stateNode} = node; |
| 67 | const instance = getPublicInstance(stateNode); |
| 68 | if (instance !== null && fn(type, memoizedProps, instance) === true) { |
| 69 | return instance; |
| 70 | } |
| 71 | } |
| 72 | let child = node.child; |
| 73 | |
| 74 | if (isFiberSuspenseAndTimedOut(node)) { |
| 75 | child = getSuspenseFallbackChild(node); |
| 76 | } |
| 77 | if (child !== null) { |
| 78 | return collectFirstScopedNodeFromChildren(child, fn); |
| 79 | } |
| 80 | } |
| 81 | return null; |
| 82 | } |
| 83 | |
| 84 | function collectScopedNodesFromChildren( |
| 85 | startingChild: Fiber, |
no test coverage detected