Skip to content

Commit 87fcdff

Browse files
rubennortefacebook-github-bot
authored andcommitted
Expose new method in Fabric renderer to access root instance from root 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
1 parent 3990c10 commit 87fcdff

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

packages/react-native/Libraries/ReactNative/RendererImplementation.js

+9
Original file line numberDiff line numberDiff line change
@@ -162,3 +162,12 @@ export function getPublicInstanceFromInternalInstanceHandle(
162162
internalInstanceHandle,
163163
);
164164
}
165+
166+
export function getPublicInstanceFromRootTag(
167+
rootTag: number,
168+
): mixed /*PublicRootInstance | null*/ {
169+
// This is only available in Fabric
170+
return require('../Renderer/shims/ReactFabric').default.getPublicInstanceFromRootTag(
171+
rootTag,
172+
);
173+
}

packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js

+3
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,9 @@ export type ReactFabricType = {
262262
getPublicInstanceFromInternalInstanceHandle(
263263
internalInstanceHandle: InternalInstanceHandle,
264264
): PublicInstance | PublicTextInstance | null,
265+
getPublicInstanceFromRootTag(
266+
rootTag: number,
267+
): PublicRootInstance | null,
265268
...
266269
};
267270

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

+1
Original file line numberDiff line numberDiff line change
@@ -7621,6 +7621,7 @@ declare export function getNodeFromInternalInstanceHandle(
76217621
declare export function getPublicInstanceFromInternalInstanceHandle(
76227622
internalInstanceHandle: InternalInstanceHandle
76237623
): mixed;
7624+
declare export function getPublicInstanceFromRootTag(rootTag: number): mixed;
76247625
"
76257626
`;
76267627

0 commit comments

Comments
 (0)