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.

IMPORTANT: this is blocked on a RN renderer sync from the `react` repository implementing the necessary changes.

Reviewed By: javache

Differential Revision: D68767143
  • Loading branch information
rubennorte authored and facebook-github-bot committed Jan 29, 2025
1 parent 1ae5a8a commit eb27f68
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 @@ -261,6 +261,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 @@ -7693,6 +7693,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 eb27f68

Please sign in to comment.