* 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)
| 5887 | * other). If React trees are not nested, returns null. |
| 5888 | */ |
| 5889 | function findRootContainerNode(inst) { |
| 5890 | // TODO: It may be a good idea to cache this to prevent unnecessary DOM |
| 5891 | // traversal, but caching is difficult to do correctly without using a |
| 5892 | // mutation observer to listen for all DOM changes. |
| 5893 | while (inst['return']) { |
| 5894 | inst = inst['return']; |
| 5895 | } |
| 5896 | if (inst.tag !== HostRoot) { |
| 5897 | // This can happen if we're in a detached tree. |
| 5898 | return null; |
| 5899 | } |
| 5900 | return inst.stateNode.containerInfo; |
| 5901 | } |
| 5902 | |
| 5903 | // Used to store ancestor hierarchy in top level callback |
| 5904 | function getTopLevelCallbackBookKeeping(topLevelType, nativeEvent, targetInst) { |