Skip to content

Commit

Permalink
feat[ReactFabricPrivateInterface]: add getInternalInstanceHandleFromP…
Browse files Browse the repository at this point in the history
…ublicInstance (facebook#41786)

Summary:

Changelog: [Internal]

This is the preprequisite for facebook/react#27783

Reviewed By: rubennorte

Differential Revision: D51808831
  • Loading branch information
Ruslan Lesiutin authored and facebook-github-bot committed Dec 4, 2023
1 parent 09b110f commit 02c460a
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@
* @flow strict-local
*/

/**
* This module is meant to be used by the React renderers to create public
* instances and get some data from them (like their instance handle / fiber).
*/

import type ReactNativeElement from '../../DOM/Nodes/ReactNativeElement';
import type ReadOnlyText from '../../DOM/Nodes/ReadOnlyText';
import typeof ReactFabricType from '../../Renderer/shims/ReactFabric';
Expand Down Expand Up @@ -79,3 +84,9 @@ export function getNodeFromPublicInstance(
publicInstance.__internalInstanceHandle,
);
}

export function getInternalInstanceHandleFromPublicInstance(
publicInstance: ReactFabricHostComponent | ReactNativeElement,
): InternalInstanceHandle {
return publicInstance.__internalInstanceHandle;
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import typeof CustomEvent from '../Events/CustomEvent';
import typeof {
createPublicInstance,
createPublicTextInstance,
getInternalInstanceHandleFromPublicInstance,
getNativeTagFromPublicInstance,
getNodeFromPublicInstance,
} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
Expand Down Expand Up @@ -108,4 +109,8 @@ module.exports = {
return require('../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
.getNodeFromPublicInstance;
},
get getInternalInstanceHandleFromPublicInstance(): getInternalInstanceHandleFromPublicInstance {
return require('../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
.getInternalInstanceHandleFromPublicInstance;
},
};

0 comments on commit 02c460a

Please sign in to comment.