Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion packages/react-native/Libraries/DOM/Nodes/ReadOnlyNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import type NodeList from '../OldStyleCollections/NodeList';
import type ReadOnlyElement from './ReadOnlyElement';

import {getFabricUIManager} from '../../ReactNative/FabricUIManager';
import ReactFabric from '../../Renderer/shims/ReactFabric';
import {createNodeList} from '../OldStyleCollections/NodeList';
import nullthrows from 'nullthrows';

Expand Down Expand Up @@ -309,6 +308,9 @@ function setInstanceHandle(
}

export function getShadowNode(node: ReadOnlyNode): ?ShadowNode {
// Lazy import Fabric here to avoid DOM Node APIs classes from having side-effects.
// With a static import we can't use these classes for Paper-only variants.
const ReactFabric = require('../../Renderer/shims/ReactFabric');
return ReactFabric.getNodeFromInternalInstanceHandle(getInstanceHandle(node));
}

Expand Down Expand Up @@ -353,6 +355,9 @@ function getNodeSiblingsAndPosition(
export function getPublicInstanceFromInternalInstanceHandle(
instanceHandle: InternalInstanceHandle,
): ?ReadOnlyNode {
// Lazy import Fabric here to avoid DOM Node APIs classes from having side-effects.
// With a static import we can't use these classes for Paper-only variants.
const ReactFabric = require('../../Renderer/shims/ReactFabric');
const mixedPublicInstance =
ReactFabric.getPublicInstanceFromInternalInstanceHandle(instanceHandle);
// $FlowExpectedError[incompatible-return] React defines public instances as "mixed" because it can't access the definition from React Native.
Expand Down