MCPcopy
hub / github.com/facebook/react / findHostInstance

Function findHostInstance

packages/react-reconciler/src/ReactFiberReconciler.js:161–178  ·  view source on GitHub ↗
(component: Object)

Source from the content-addressed store, hash-verified

159}
160
161function findHostInstance(component: Object): PublicInstance | null {
162 const fiber = getInstance(component);
163 if (fiber === undefined) {
164 if (typeof component.render === 'function') {
165 throw new Error('Unable to find node on an unmounted component.');
166 } else {
167 const keys = Object.keys(component).join(',');
168 throw new Error(
169 `Argument appears to not be a ReactComponent. Keys: ${keys}`,
170 );
171 }
172 }
173 const hostFiber = findCurrentHostFiber(fiber);
174 if (hostFiber === null) {
175 return null;
176 }
177 return getPublicInstance(hostFiber.stateNode);
178}
179
180function findHostInstanceWithWarning(
181 component: Object,

Callers 6

findNodeHandleFunction · 0.90
findDOMNodeFunction · 0.90
findDOMNodeFunction · 0.90
findDOMNodeFunction · 0.90

Calls 5

findCurrentHostFiberFunction · 0.90
getPublicInstanceFunction · 0.90
getInstanceFunction · 0.85
joinMethod · 0.80
keysMethod · 0.80

Tested by

no test coverage detected