{"record":{"id":"28f2b63ec5317f37","repo":"facebook/react","slug":"320-28f2b6","errorCode":"320","errorMessage":"Expected ReactFiberErrorDialog.showErrorDialog to be a function.","messagePattern":"Expected ReactFiberErrorDialog\\.showErrorDialog to be a function\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"packages/react-native-renderer/src/ReactFabric.js","lineNumber":55,"sourceCode":"  sendAccessibilityEvent,\n  getNodeFromInternalInstanceHandle,\n  isChildPublicInstance,\n} from './ReactNativePublicCompat';\nimport {getPublicInstanceFromInternalInstanceHandle} from './ReactFiberConfigFabric';\n\n// Module provided by RN:\nimport {\n  ReactFiberErrorDialog,\n  createPublicRootInstance,\n  type PublicRootInstance,\n} from 'react-native/react-private-interface';\nimport {\n  disableLegacyMode,\n  enableDefaultTransitionIndicator,\n} from 'shared/ReactFeatureFlags';\n\nif (typeof ReactFiberErrorDialog.showErrorDialog !== 'function') {\n  throw new Error(\n    'Expected ReactFiberErrorDialog.showErrorDialog to be a function.',\n  );\n}\n\nfunction nativeOnUncaughtError(\n  error: mixed,\n  errorInfo: {+componentStack?: ?string},\n): void {\n  const componentStack =\n    errorInfo.componentStack != null ? errorInfo.componentStack : '';\n  const logError = ReactFiberErrorDialog.showErrorDialog({\n    errorBoundary: null,\n    error,\n    componentStack,\n  });\n\n  // Allow injected showErrorDialog() to prevent default console.error logging.\n  // This enables renderers like ReactNative to better manage redbox behavior.","sourceCodeStart":37,"sourceCodeEnd":73,"githubUrl":"https://github.com/facebook/react/blob/eafeac097ba51e1eab809c07102126bd5f8e5425/packages/react-native-renderer/src/ReactFabric.js#L37-L73","documentation":"react-native-renderer's Fabric entry (ReactFabric.js) validates at module load that react-native's private interface ('react-native/react-private-interface') exports ReactFiberErrorDialog.showErrorDialog, which is how the renderer surfaces uncaught/caught errors to RN's RedBox/LogBox. If the installed react-native version's private interface lacks it, the import itself throws and nothing renders - a build/config problem, not a runtime usage error.","triggerScenarios":"Loading ReactFabric against a react-native whose react-private-interface does not export ReactFiberErrorDialog.showErrorDialog - a react vs react-native version skew, a Metro resolver alias, or a Jest moduleNameMapper mock of react-native that omits the private interface.","commonSituations":"Upgrading react independently of react-native (RN pins an exact react release); duplicate hoisted copies in node_modules; coarse jest mocks of 'react-native'; community RN forks with divergent internals.","solutions":["Use the react version pinned by your react-native release (check the RN changelog/peerDependencies) and reinstall so exactly one pair exists.","Inspect Metro resolver.extraNodeModules / babel-module-resolver aliases and jest moduleNameMapper for stale react-native mocks that hide react-private-interface.","Run 'npm ls react react-native' (or yarn equivalent) to confirm no duplicate or skewed copies, then reset Metro/watchman caches and rebuild."],"exampleFix":"// jest.config.js - before\nmoduleNameMapper: {'^react-native$': '<rootDir>/__mocks__/react-native.js'}\n\n// after - mock only the private interface, keeping its real shape\nmoduleNameMapper: {\n  '^react-native/react-private-interface$':\n    '<rootDir>/__mocks__/react-private-interface.js',\n}\n// __mocks__/react-private-interface.js must export ReactFiberErrorDialog with a showErrorDialog function","handlingStrategy":"validation","validationCode":"import {ReactFiberErrorDialog} from 'react-native/react-private-interface';\nif (\n  ReactFiberErrorDialog == null ||\n  typeof ReactFiberErrorDialog.showErrorDialog !== 'function'\n) {\n  throw new Error(\n    'react/react-native mismatch: use the react release pinned by your react-native version',\n  );\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use the react version pinned by your react-native release.","Run 'npm ls react react-native' after installs to catch duplicate or skewed copies.","When mocking react-native in Jest, mock react-native/react-private-interface with its full shape."],"tags":["react-native","version-mismatch","module-init","fabric","peer-dependencies"],"backgroundTag":"peer-dependency-version-mismatch","analyzedSha":"eafeac097ba51e1eab809c07102126bd5f8e5425","analyzedAt":"2026-08-21T22:01:08.818Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}