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

Function findCurrentHostFiber

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

Source from the content-addressed store, hash-verified

5280}
5281
5282function findCurrentHostFiber(parent) {
5283 var currentParent = findCurrentFiberUsingSlowPath(parent);
5284 if (!currentParent) {
5285 return null;
5286 }
5287
5288 // Next we'll drill down this component to find the first HostComponent/Text.
5289 var node = currentParent;
5290 while (true) {
5291 if (node.tag === HostComponent || node.tag === HostText) {
5292 return node;
5293 } else if (node.child) {
5294 node.child['return'] = node;
5295 node = node.child;
5296 continue;
5297 }
5298 if (node === currentParent) {
5299 return null;
5300 }
5301 while (!node.sibling) {
5302 if (!node['return'] || node['return'] === currentParent) {
5303 return null;
5304 }
5305 node = node['return'];
5306 }
5307 node.sibling['return'] = node['return'];
5308 node = node.sibling;
5309 }
5310 // Flow needs the return null here, but ESLint complains about it.
5311 // eslint-disable-next-line no-unreachable
5312 return null;
5313}
5314
5315function findCurrentHostFiberWithNoPortals(parent) {
5316 var currentParent = findCurrentFiberUsingSlowPath(parent);

Callers 1

findHostInstanceFunction · 0.70

Calls 1

Tested by

no test coverage detected