Skip to content

Commit a171893

Browse files
hoxyqfacebook-github-bot
authored andcommitted
fix[getInternalInstanceHandleFromPublicInstance]: make it backwards compatible with previous Fabric implementation (facebook#42250)
Summary: Changelog: [Internal] Currently, OSS versions ofReactFabric and ReactNativeRenderer artifacts are ~2 years behind the FB version. Fabric host components store internal instance in __internalInstanceHandle field, previously they have been storing it in the field with the same name, but with one underscore in prefix: https://www.internalfb.com/code/fbsource/[79c52d10beb6]/xplat/js/react-native-github/packages/react-native/Libraries/Renderer/implementations/ReactFabric-dev.js?lines=5151 Once these artifacts will be synced, the implementation will use __internalInstanceHandle field, so we can safely remove the branch with a single underscore prefix. Reviewed By: rubennorte Differential Revision: D52697886
1 parent 0dd27f2 commit a171893

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,5 +88,12 @@ export function getNodeFromPublicInstance(
8888
export function getInternalInstanceHandleFromPublicInstance(
8989
publicInstance: ReactFabricHostComponent | ReactNativeElement,
9090
): InternalInstanceHandle {
91+
// TODO(T174762768): Remove this once OSS versions of renderers will be synced.
92+
// $FlowExpectedError[prop-missing] Keeping this for backwards-compatibility with the renderers versions in open source.
93+
if (publicInstance._internalInstanceHandle != null) {
94+
// $FlowExpectedError[incompatible-return] Keeping this for backwards-compatibility with the renderers versions in open source.
95+
return publicInstance._internalInstanceHandle;
96+
}
97+
9198
return publicInstance.__internalInstanceHandle;
9299
}

0 commit comments

Comments
 (0)