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: af2bacfc8bf38f45ddc950d43615fc2f02476c3a
  • Loading branch information
Ruslan Lesiutin authored and facebook-github-bot committed Jan 15, 2024
1 parent f8ddd1e commit 0491d21
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 0491d21

Please sign in to comment.