Skip to content

Commit

Permalink
Implement ReactNativePrivateInterface.createPublicTextInstance
Browse files Browse the repository at this point in the history
Summary:
This exposes a new method in the private interface used by React so we can merge facebook/react#26516

We're adding support for text instances in React Native (as defined in react-native-community/discussions-and-proposals#607). See D44632362 for the full implementation.

Changelog: [internal]

bypass-github-export-checks

Reviewed By: sammy-SC

Differential Revision: D44663223

fbshipit-source-id: 70ca3ca9d2edefaa73a396f43c2d560c6d1422f1
  • Loading branch information
rubennorte authored and facebook-github-bot committed Apr 4, 2023
1 parent 904d56c commit 28dac61
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,13 @@ export function createPublicInstance(
return new ReactFabricHostComponent(tag, viewConfig, internalInstanceHandle);
}

export function createPublicTextInstance(internalInstanceHandle: mixed): {} {
// React will call this method to create text instances but we'll return an
// empty object for now. These instances are only created lazily when
// traversing the tree, and that's not enabled yet.
return {};
}

export function getNativeTagFromPublicInstance(
publicInstance: ReactFabricHostComponent,
): number {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import typeof RCTEventEmitter from '../EventEmitter/RCTEventEmitter';
import typeof CustomEvent from '../Events/CustomEvent';
import typeof {
createPublicInstance,
createPublicTextInstance,
getNativeTagFromPublicInstance,
getNodeFromPublicInstance,
} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
Expand Down Expand Up @@ -94,6 +95,10 @@ module.exports = {
return require('../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
.createPublicInstance;
},
get createPublicTextInstance(): createPublicTextInstance {
return require('../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
.createPublicTextInstance;
},
get getNativeTagFromPublicInstance(): getNativeTagFromPublicInstance {
return require('../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance')
.getNativeTagFromPublicInstance;
Expand Down

0 comments on commit 28dac61

Please sign in to comment.