Prepare for removal of types in ReactNativeTypes (#49602)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/49602

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 https://github.com/facebook/react/pull/32446

Reviewed By: huntie

Differential Revision: D69996009

fbshipit-source-id: 3c156b4dede8e217d6a828ab310533a2f8bfd42c
This commit is contained in:
Rubén Norte
2025-02-24 05:32:43 -08:00
committed by Facebook GitHub Bot
parent e630b2ca18
commit dbc0bf34ea
3 changed files with 16 additions and 6 deletions
@@ -8,13 +8,11 @@
* @flow strict-local
*/
import type {HostComponent} from '../../src/private/types/HostComponent';
import type {HostInstance} from '../../src/private/types/HostInstance';
import type {
InternalInstanceHandle,
Node,
} from '../Renderer/shims/ReactNativeTypes';
import type ReactFabricHostComponent from './ReactFabricPublicInstance/ReactFabricHostComponent';
import type {ElementRef, ElementType} from 'react';
import {
@@ -136,8 +134,8 @@ export function isProfilingRenderer(): boolean {
}
export function isChildPublicInstance(
parentInstance: ReactFabricHostComponent | HostComponent<empty>,
childInstance: ReactFabricHostComponent | HostComponent<empty>,
parentInstance: HostInstance,
childInstance: HostInstance,
): boolean {
return require('../Renderer/shims/ReactNative').default.isChildPublicInstance(
parentInstance,
@@ -36,7 +36,19 @@ import typeof deepFreezeAndThrowOnMutationInDev from '../Utilities/deepFreezeAnd
import typeof deepDiffer from '../Utilities/differ/deepDiffer';
import typeof Platform from '../Utilities/Platform';
// Expose these types to the React renderer
export type {
HostInstance as PublicInstance,
// These types are only necessary for Paper
INativeMethods as LegacyPublicInstance,
MeasureOnSuccessCallback,
MeasureInWindowOnSuccessCallback,
MeasureLayoutOnSuccessCallback,
} from '../../src/private/types/HostInstance';
export type {PublicRootInstance} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
export type PublicTextInstance = ReturnType<createPublicTextInstance>;
// flowlint unsafe-getters-setters:off
module.exports = {
@@ -6976,8 +6976,8 @@ declare export function unstable_batchedUpdates<T>(
): void;
declare export function isProfilingRenderer(): boolean;
declare export function isChildPublicInstance(
parentInstance: ReactFabricHostComponent | HostComponent<empty>,
childInstance: ReactFabricHostComponent | HostComponent<empty>
parentInstance: HostInstance,
childInstance: HostInstance
): boolean;
declare export function getNodeFromInternalInstanceHandle(
internalInstanceHandle: InternalInstanceHandle