{"record":{"id":"999e170a34c13666","repo":"necolas/react-native-web","slug":"findnodehandle-is-not-supported-on-web-use-the-re","errorCode":null,"errorMessage":"findNodeHandle is not supported on web. Use the ref property on the component instead.","messagePattern":"findNodeHandle is not supported on web\\. Use the ref property on the component instead\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/react-native-web/src/exports/findNodeHandle/index.js","lineNumber":12,"sourceCode":"/**\n * Copyright (c) Nicolas Gallagher.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @noflow\n */\n\nconst findNodeHandle = (component) => {\n  throw new Error(\n    'findNodeHandle is not supported on web. ' +\n      'Use the ref property on the component instead.'\n  );\n};\n\nexport default findNodeHandle;\n","sourceCodeStart":1,"sourceCodeEnd":19,"githubUrl":"https://github.com/necolas/react-native-web/blob/a9de220ba9e65bdea540fb5322ffb1da2b0bf442/packages/react-native-web/src/exports/findNodeHandle/index.js#L1-L19","documentation":"findNodeHandle relies on native host component instances that don't exist in the DOM; react-native-web exports it as a stub that always throws. Developers should use refs (DOM nodes) directly. There is no path that returns a handle — any call fails.","triggerScenarios":"Calling findNodeHandle(ref.current) (or importing the module and invoking it) anywhere in a react-native-web app.","commonSituations":"Porting RN libraries that use findNodeHandle for measure/accessibility/scroll APIs; copying native-only code (e.g. camera, animation libs) to web; RN's own docs examples using findNodeHandle.","solutions":["Replace with the ref directly: ref.current is the DOM node on web — pass it where a node is needed.","For measure-like needs, read node.getBoundingClientRect() / getComputedStyle instead of native measure.","Guard library code: use Platform.OS checks or optional shims so findNodeHandle is only called on native.","Set the DOM node via callback ref and store it for later use."],"exampleFix":"// before\nconst handle = findNodeHandle(ref.current);\n// after\nconst node = ref.current; // DOM element on web\nconst rect = node && node.getBoundingClientRect();","handlingStrategy":"fallback","validationCode":"import { Platform } from 'react-native';\nif (Platform.OS === 'web') {\n  // never call findNodeHandle; use ref.current directly\n}","typeGuard":"const isWeb = () => Platform.OS === 'web' || typeof document !== 'undefined';","tryCatchPattern":"function getNode(ref) {\n  try { return findNodeHandle(ref.current); }\n  catch (e) { if (/not supported on web/.test(e.message)) return ref.current; throw e; }\n}","preventionTips":["Treat ref.current as the DOM node on web","Replace native measure() with getBoundingClientRect()","Wrap vendor libraries that call findNodeHandle with a web shim"],"tags":["react-native-web","findnodehandle","unsupported-api","web"],"backgroundTag":"api-not-supported-on-web","analyzedSha":"a9de220ba9e65bdea540fb5322ffb1da2b0bf442","analyzedAt":"2026-09-01T10:01:09.883Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T15:18:49.778Z"}