Skip to content

Commit cfd54c1

Browse files
hoxyqfacebook-github-bot
authored andcommitted
[skip ci] fix[getInternalInstanceHandleFromPublicInstance]: make it backwards compatible with previous Fabric implementation
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. Differential Revision: D52697886
1 parent 3630138 commit cfd54c1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

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

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

0 commit comments

Comments
 (0)