Skip to content

Move DOM APIs to native module #43512

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
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
51 changes: 0 additions & 51 deletions packages/react-native/Libraries/ReactNative/FabricUIManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,7 @@ export interface Spec {
locationY: number,
callback: (instanceHandle: ?InternalInstanceHandle) => void,
) => void;

/**
* Support methods for the DOM-compatible APIs.
*/
+getParentNode: (node: Node) => ?InternalInstanceHandle;
+getChildNodes: (node: Node) => $ReadOnlyArray<InternalInstanceHandle>;
+isConnected: (node: Node) => boolean;
+compareDocumentPosition: (node: Node, otherNode: Node) => number;
+getTextContent: (node: Node) => string;
+getBoundingClientRect: (
node: Node,
includeTransform: boolean,
Expand All @@ -88,36 +80,6 @@ export interface Spec {
/* width: */ number,
/* height: */ number,
];
+getOffset: (
node: Node,
) => ?[
/* offsetParent: */ InternalInstanceHandle,
/* offsetTop: */ number,
/* offsetLeft: */ number,
];
+getScrollPosition: (
node: Node,
) => ?[/* scrollLeft: */ number, /* scrollTop: */ number];
+getScrollSize: (
node: Node,
) => ?[/* scrollWidth: */ number, /* scrollHeight: */ number];
+getInnerSize: (node: Node) => ?[/* width: */ number, /* height: */ number];
+getBorderSize: (
node: Node,
) => ?[
/* topWidth: */ number,
/* rightWidth: */ number,
/* bottomWidth: */ number,
/* leftWidth: */ number,
];
+getTagName: (node: Node) => string;

/**
* Support methods for the Pointer Capture APIs.
*/
+hasPointerCapture: (node: Node, pointerId: number) => boolean;
+setPointerCapture: (node: Node, pointerId: number) => void;
+releasePointerCapture: (node: Node, pointerId: number) => void;
}

let nativeFabricUIManagerProxy: ?Spec;
Expand All @@ -143,21 +105,8 @@ const CACHED_PROPERTIES = [
'findShadowNodeByTag_DEPRECATED',
'setNativeProps',
'dispatchCommand',
'getParentNode',
'getChildNodes',
'isConnected',
'compareDocumentPosition',
'getTextContent',
'getBoundingClientRect',
'getOffset',
'getScrollPosition',
'getScrollSize',
'getInnerSize',
'getBorderSize',
'getTagName',
'hasPointerCapture',
'setPointerCapture',
'releasePointerCapture',
];

// This is exposed as a getter because apps using the legacy renderer AND
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ jest.mock('../../FabricUIManager', () =>
require('../../__mocks__/FabricUIManager'),
);

jest.mock('../../../../src/private/webapis/dom/nodes/specs/NativeDOM', () =>
require('../../../../src/private/webapis/dom/nodes/specs/__mocks__/NativeDOMMock'),
);

/**
* Given a mocked function, get a correctly typed mock function that preserves
* the original function's type.
Expand Down
Loading