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 (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
  • Loading branch information
hoxyq authored and facebook-github-bot committed Jan 15, 2024
1 parent c5cbe84 commit c56a41f
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,5 +88,12 @@ export function getNodeFromPublicInstance(
export function getInternalInstanceHandleFromPublicInstance(
publicInstance: ReactFabricHostComponent | ReactNativeElement,
): 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.
if (publicInstance._internalInstanceHandle != null) {
// $FlowExpectedError[incompatible-return] Keeping this for backwards-compatibility with the renderers versions in open source.
return publicInstance._internalInstanceHandle;
}

return publicInstance.__internalInstanceHandle;
}

0 comments on commit c56a41f

Please sign in to comment.