Skip to content

Commit

Permalink
fix[getInternalInstanceHandleFromPublicInstance]: make it backwards c…
Browse files Browse the repository at this point in the history
…ompatible 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

fbshipit-source-id: 79e85086a7e0f938771b54fd532da2abd6c70dc5
  • Loading branch information
Ruslan Lesiutin authored and facebook-github-bot committed Jan 11, 2024
1 parent 3630138 commit 2abcd69
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,11 @@ export function getNodeFromPublicInstance(
export function getInternalInstanceHandleFromPublicInstance(
publicInstance: ReactFabricHostComponent | ReactNativeElement,
): InternalInstanceHandle {
return publicInstance.__internalInstanceHandle;
if (publicInstance.__internalInstanceHandle != null) {
return publicInstance.__internalInstanceHandle;
}

// TODO(T174762768): Remove this once OSS versions of renderers will be synced.
// $FlowExpectedError[prop-missing] Keeping this for backwards-compatibility with the renderers versions in open source.
return publicInstance._internalInstanceHandle;
}

0 comments on commit 2abcd69

Please sign in to comment.