* Find the deepest React component completely containing the root of the * passed-in instance (for use when entire React trees are nested within each * other). If React trees are not nested, returns null.
(inst)
| 6045 | * other). If React trees are not nested, returns null. |
| 6046 | */ |
| 6047 | function findRootContainerNode(inst) { |
| 6048 | // TODO: It may be a good idea to cache this to prevent unnecessary DOM |
| 6049 | // traversal, but caching is difficult to do correctly without using a |
| 6050 | // mutation observer to listen for all DOM changes. |
| 6051 | while (inst['return']) { |
| 6052 | inst = inst['return']; |
| 6053 | } |
| 6054 | if (inst.tag !== HostRoot) { |
| 6055 | // This can happen if we're in a detached tree. |
| 6056 | return null; |
| 6057 | } |
| 6058 | return inst.stateNode.containerInfo; |
| 6059 | } |
| 6060 | |
| 6061 | // Used to store ancestor hierarchy in top level callback |
| 6062 | function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) { |