{"record":{"id":"ce5ed5e5c1860fdb","repo":"facebook/react","slug":"ischildpublicinstance-is-not-available-in-produc","errorCode":null,"errorMessage":"isChildPublicInstance() is not available in production.","messagePattern":"isChildPublicInstance\\(\\) is not available in production\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-native-renderer/src/ReactNativePublicCompat.js","lineNumber":214,"sourceCode":"      // $FlowExpectedError[incompatible-call] Type for parentInstance should have been PublicInstance from ReactFiberConfigFabric.\n      getInternalInstanceHandleFromPublicInstance(parentInstance);\n    const childInternalInstanceHandle =\n      // $FlowExpectedError[incompatible-call] Type for childInstance should have been PublicInstance from ReactFiberConfigFabric.\n      getInternalInstanceHandleFromPublicInstance(childInstance);\n\n    if (\n      parentInternalInstanceHandle != null &&\n      childInternalInstanceHandle != null\n    ) {\n      return doesFiberContain(\n        parentInternalInstanceHandle,\n        childInternalInstanceHandle,\n      );\n    }\n\n    return false;\n  } else {\n    throw new Error('isChildPublicInstance() is not available in production.');\n  }\n}\n","sourceCodeStart":196,"sourceCodeEnd":217,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-native-renderer/src/ReactNativePublicCompat.js#L196-L217","documentation":"ReactNativePublicCompat.isChildPublicInstance is a legacy public-instance ancestry check (used by DevTools/test utilities) whose backing internals are stripped from production bundles; calling it there throws. Like the inspector helpers, it is dev-tooling surface and must not ship in release code paths.","triggerScenarios":"Calling isChildPublicInstance(parent, child) in a production bundle - typically from test utilities, DevTools glue, or compatibility shims that were accidentally imported into app code.","commonSituations":"Test helpers imported into app bundles; libraries integrating with RN renderer internals; leftover debugging code from a DevTools integration.","solutions":["Guard calls with if (__DEV__).","Keep such utilities in dev/test-only entry points so they are eliminated from release bundles.","For production ancestry needs, keep your own parent/child bookkeeping instead of renderer internals."],"exampleFix":"// before\nconst contains = isChildPublicInstance(parent, child);\n\n// after\nlet contains = false;\nif (__DEV__) {\n  contains = isChildPublicInstance(parent, child);\n}","handlingStrategy":"validation","validationCode":"let contains = false;\nif (__DEV__) {\n  contains = isChildPublicInstance(parent, child);\n} else {\n  // not available in production bundles\n}","typeGuard":"const canUsePublicCompat = () => Boolean(__DEV__);","tryCatchPattern":null,"preventionTips":["Gate public-instance compat calls with __DEV__.","Keep test/DevTools utilities out of release entry points.","Use your own ancestry bookkeeping for production logic."],"tags":["react-native","dev-only-api","production","public-instance"],"backgroundTag":"dev-only-api-in-production","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-22T04:17:13.399Z"}