Skip to content

Commit

Permalink
Expose new method in Fabric renderer to access root instance from roo…
Browse files Browse the repository at this point in the history
…t tag (facebook#49011)

Summary:

Changelog: [internal]

This exposes the new `getPublicInstanceFromRoot` method from the React renderer in our RN façades, preparing for the new change to implement the document interface in RN.

Reviewed By: javache

Differential Revision: D68767143
  • Loading branch information
rubennorte authored and facebook-github-bot committed Jan 30, 2025
1 parent d790bf3 commit a43f08e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,12 @@ export function getPublicInstanceFromInternalInstanceHandle(
internalInstanceHandle,
);
}

export function getPublicInstanceFromRootTag(
rootTag: number,
): mixed /*PublicRootInstance | null*/ {
// This is only available in Fabric
return require('../Renderer/shims/ReactFabric').default.getPublicInstanceFromRootTag(
rootTag,
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,9 @@ export type ReactFabricType = {
getPublicInstanceFromInternalInstanceHandle(
internalInstanceHandle: InternalInstanceHandle,
): PublicInstance | PublicTextInstance | null,
getPublicInstanceFromRootTag(
rootTag: number,
): PublicRootInstance | null,
...
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7621,6 +7621,7 @@ declare export function getNodeFromInternalInstanceHandle(
declare export function getPublicInstanceFromInternalInstanceHandle(
internalInstanceHandle: InternalInstanceHandle
): mixed;
declare export function getPublicInstanceFromRootTag(rootTag: number): mixed;
"
`;

Expand Down

0 comments on commit a43f08e

Please sign in to comment.