MCPcopy Create free account
hub / github.com/krasimir/react-in-patterns / findCurrentHostFiberWithNoPortals

Function findCurrentHostFiberWithNoPortals

code/styling/public/app.js:5315–5346  ·  view source on GitHub ↗
(parent)

Source from the content-addressed store, hash-verified

5313}
5314
5315function findCurrentHostFiberWithNoPortals(parent) {
5316 var currentParent = findCurrentFiberUsingSlowPath(parent);
5317 if (!currentParent) {
5318 return null;
5319 }
5320
5321 // Next we'll drill down this component to find the first HostComponent/Text.
5322 var node = currentParent;
5323 while (true) {
5324 if (node.tag === HostComponent || node.tag === HostText) {
5325 return node;
5326 } else if (node.child && node.tag !== HostPortal) {
5327 node.child['return'] = node;
5328 node = node.child;
5329 continue;
5330 }
5331 if (node === currentParent) {
5332 return null;
5333 }
5334 while (!node.sibling) {
5335 if (!node['return'] || node['return'] === currentParent) {
5336 return null;
5337 }
5338 node = node['return'];
5339 }
5340 node.sibling['return'] = node['return'];
5341 node = node.sibling;
5342 }
5343 // Flow needs the return null here, but ESLint complains about it.
5344 // eslint-disable-next-line no-unreachable
5345 return null;
5346}
5347
5348function addEventBubbleListener(element, eventType, listener) {
5349 element.addEventListener(eventType, listener, false);

Callers 1

ReactFiberReconciler$1Function · 0.70

Calls 1

Tested by

no test coverage detected