isChildPublicInstance() — react Function Reference
Architecture documentation for the isChildPublicInstance() function in ReactNativePublicCompat.js from the react codebase.
Entity Profile
Dependency Diagram
graph TD 38298ff1_0df9_bd75_4ee6_624ce5b5207d["isChildPublicInstance()"] c8cde18a_a62b_2ad5_9e88_a5d655a07f02["ReactNativePublicCompat.js"] 38298ff1_0df9_bd75_4ee6_624ce5b5207d -->|defined in| c8cde18a_a62b_2ad5_9e88_a5d655a07f02 style 38298ff1_0df9_bd75_4ee6_624ce5b5207d fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/react-native-renderer/src/ReactNativePublicCompat.js lines 227–272
export function isChildPublicInstance(
parentInstance: PublicInstance,
childInstance: PublicInstance,
): boolean {
if (__DEV__) {
// Paper
if (
// $FlowExpectedError[incompatible-type]
// $FlowExpectedError[prop-missing] Don't check via `instanceof ReactNativeFiberHostComponent`, so it won't be leaked to Fabric.
parentInstance._internalFiberInstanceHandleDEV &&
// $FlowExpectedError[incompatible-type]
// $FlowExpectedError[prop-missing] Don't check via `instanceof ReactNativeFiberHostComponent`, so it won't be leaked to Fabric.
childInstance._internalFiberInstanceHandleDEV
) {
return doesFiberContain(
// $FlowExpectedError[incompatible-call]
parentInstance._internalFiberInstanceHandleDEV,
// $FlowExpectedError[incompatible-call]
childInstance._internalFiberInstanceHandleDEV,
);
}
const parentInternalInstanceHandle =
// $FlowExpectedError[incompatible-call] Type for parentInstance should have been PublicInstance from ReactFiberConfigFabric.
getInternalInstanceHandleFromPublicInstance(parentInstance);
const childInternalInstanceHandle =
// $FlowExpectedError[incompatible-call] Type for childInstance should have been PublicInstance from ReactFiberConfigFabric.
getInternalInstanceHandleFromPublicInstance(childInstance);
// Fabric
if (
parentInternalInstanceHandle != null &&
childInternalInstanceHandle != null
) {
return doesFiberContain(
parentInternalInstanceHandle,
childInternalInstanceHandle,
);
}
// Means that one instance is from Fabric and other is from Paper.
return false;
} else {
throw new Error('isChildPublicInstance() is not available in production.');
}
}
Domain
Subdomains
Source
Frequently Asked Questions
What does isChildPublicInstance() do?
isChildPublicInstance() is a function in the react codebase, defined in packages/react-native-renderer/src/ReactNativePublicCompat.js.
Where is isChildPublicInstance() defined?
isChildPublicInstance() is defined in packages/react-native-renderer/src/ReactNativePublicCompat.js at line 227.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free