Skip to content

Commit 758f3c6

Browse files
rubennortefacebook-github-bot
authored andcommitted
Prepare for removal of types in ReactNativeTypes
Summary: Changelog: [internal] This just prepares for the removal of some types from `ReactNativeTypes`, and defines some types in `ReactNativePrivateInterface` that `ReactNativeTypes` expects to be defined after (PR). Differential Revision: D69996009
1 parent e4d650a commit 758f3c6

File tree

2 files changed

+15
-4
lines changed

2 files changed

+15
-4
lines changed

packages/react-native/Libraries/ReactNative/RendererImplementation.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,11 @@
88
* @flow strict-local
99
*/
1010

11-
import type {HostComponent, HostInstance} from '../..';
11+
import type {HostInstance} from '../..';
1212
import type {
1313
InternalInstanceHandle,
1414
Node,
1515
} from '../Renderer/shims/ReactNativeTypes';
16-
import type ReactFabricHostComponent from './ReactFabricPublicInstance/ReactFabricHostComponent';
1716
import type {ElementRef, ElementType} from 'react';
1817

1918
import {
@@ -135,8 +134,8 @@ export function isProfilingRenderer(): boolean {
135134
}
136135

137136
export function isChildPublicInstance(
138-
parentInstance: ReactFabricHostComponent | HostComponent<empty>,
139-
childInstance: ReactFabricHostComponent | HostComponent<empty>,
137+
parentInstance: HostInstance,
138+
childInstance: HostInstance,
140139
): boolean {
141140
return require('../Renderer/shims/ReactNative').default.isChildPublicInstance(
142141
parentInstance,

packages/react-native/Libraries/ReactPrivate/ReactNativePrivateInterface.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,19 @@ import typeof deepFreezeAndThrowOnMutationInDev from '../Utilities/deepFreezeAnd
3636
import typeof deepDiffer from '../Utilities/differ/deepDiffer';
3737
import typeof Platform from '../Utilities/Platform';
3838

39+
// Expose these types to the React renderer
40+
export type {
41+
HostInstance as PublicInstance,
42+
43+
// These types are only necessary for Paper
44+
INativeMethods as LegacyPublicInstance,
45+
MeasureOnSuccessCallback,
46+
MeasureInWindowOnSuccessCallback,
47+
MeasureLayoutOnSuccessCallback,
48+
} from '../Types/HostInstance';
49+
3950
export type {PublicRootInstance} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
51+
export type PublicTextInstance = ReturnType<createPublicTextInstance>;
4052

4153
// flowlint unsafe-getters-setters:off
4254
module.exports = {

0 commit comments

Comments
 (0)