Remove deprecated Libraries/ReactPrivate forwarding modules (#58452)

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

**Cleanup**: The `react-private-interface` entry point (D111231527) now provides the private contract between React and React Native that `Libraries/ReactPrivate/` (deprecated) forwarded to. We can now delete.

**Changes**

- Delete `Libraries/ReactPrivate/` — `ReactNativePrivateInterface.js`, `ReactNativePrivateInitializeCore.js`, and their `.flow`/`README` files.
- Update internal module references to point to source modules.
- Update xplat/js references to use new private entry point.

Changelog: [Internal]

Reviewed By: cortinico

Differential Revision: D114055938

fbshipit-source-id: 01f0e6961ddb78d8a39eefc1d749a3deafe01d5f
This commit is contained in:
Rubén Norte authored and meta-codesync[bot] committed 2026-09-10 17:03:25 -07:00
1 parent 625df0c277
commit c613b34020
12 files changed
+11 -63

No files matched your search

@@ -519,10 +519,6 @@ const publicAPIMapping = {
default: null,
types: ['ErrorUtils'],
},
'Libraries/ReactPrivate/ReactNativePrivateInterface': {
default: null,
types: ['PublicRootInstance', 'PublicTextInstance'],
},
};
module.exports = {
@@ -16,8 +16,8 @@ import type {AnimatedStyleAllowlist} from './AnimatedStyle';
import NativeAnimatedHelper from '../../../src/private/animated/NativeAnimatedHelper';
import * as ReactNativeFeatureFlags from '../../../src/private/featureflags/ReactNativeFeatureFlags';
import {getFabricUIManager} from '../../ReactNative/FabricUIManager';
import {getNodeFromPublicInstance} from '../../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
import {findNodeHandle} from '../../ReactNative/RendererProxy';
import {getNodeFromPublicInstance} from '../../ReactPrivate/ReactNativePrivateInterface';
import flattenStyle from '../../StyleSheet/flattenStyle';
import {AnimatedEvent} from '../AnimatedEvent';
import AnimatedNode from './AnimatedNode';
@@ -55,6 +55,8 @@ export function createPublicTextInstance(
return new ReadOnlyText(internalInstanceHandle, ownerDocument);
}
export type PublicTextInstance = ReturnType<typeof createPublicTextInstance>;
export function getNativeTagFromPublicInstance(
publicInstance: ReactNativeElement,
): number {
@@ -1 +0,0 @@
JS modules in this folder are forwarding modules to allow React to require React Native internals.
@@ -1,11 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
import '../Core/InitializeCore';
@@ -1,20 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
import typeof {createPublicTextInstance} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
export type {PublicRootInstance} from '../ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
export type PublicTextInstance = ReturnType<createPublicTextInstance>;
/**
* @deprecated Since 0.88. Use 'react-native/react-private-interface' instead.
*/
// eslint-disable-next-line @react-native/monorepo/no-commonjs-exports
module.exports = require('../../src/react-private-interface');
@@ -1,15 +0,0 @@
/**
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @flow strict-local
* @format
*/
/**
* @deprecated Since 0.88. Use 'react-native/react-private-interface' instead.
*/
export type * from '../../src/react-private-interface';
export * from '../../src/react-private-interface';
+3 -4
View File
@@ -4,7 +4,7 @@
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @generated SignedSource<<590f18ec6caea33fef591da5d56419f4>>
* @generated SignedSource<<b1273b105161b7b40e5571f4235a4812>>
*
* This file was generated by scripts/js-api/build-types/index.js.
*/
@@ -1823,7 +1823,6 @@ declare function createPublicTextInstance(
internalInstanceHandle: InternalInstanceHandle,
ownerDocument: ReactNativeDocument_default,
): ReadOnlyText_default
declare type createPublicTextInstanceT = typeof createPublicTextInstance
declare type CursorValue = "auto" | "pointer"
declare type DataDetectorTypesType =
| "address"
@@ -3705,7 +3704,7 @@ declare type ProgressBarAndroidProps =
declare type PublicRootInstance = symbol & {
__PublicRootInstance__: string
}
declare type PublicTextInstance = ReturnType<createPublicTextInstanceT>
declare type PublicTextInstance = ReturnType<typeof createPublicTextInstance>
declare interface PushNotification {
finish(result: string): void
getAlert(): (Object | undefined) | (string | undefined)
@@ -5941,7 +5940,7 @@ export {
ProgressBarAndroidInstance, // ab545ef1
ProgressBarAndroidProps, // 6484d368
PublicRootInstance, // 8040afd7
PublicTextInstance, // 6937c7bf
PublicTextInstance, // 16c26204
PushNotificationEventName, // 84e7e150
PushNotificationIOS, // b4d1fe78
PushNotificationPermissions, // c2e7ae4f
+1 -1
View File
@@ -497,7 +497,7 @@ export type {ErrorUtils} from './Libraries/vendor/core/ErrorUtils';
export type {
PublicRootInstance,
PublicTextInstance,
} from './Libraries/ReactPrivate/ReactNativePrivateInterface';
} from './Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
export type {
EventSubscription,
@@ -14,7 +14,7 @@ import '@react-native/fantom/src/setUpDefaultReactNativeEnvironment';
import type {Node} from '../../../../../Libraries/Renderer/shims/ReactNativeTypes';
import type {HostInstance} from 'react-native';
import {getNodeFromPublicInstance} from '../../../../../Libraries/ReactPrivate/ReactNativePrivateInterface';
import {getNodeFromPublicInstance} from '../../../../../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
import isUnreachable from '../isUnreachable';
import {
createShadowNodeReferenceCounter,
@@ -16,7 +16,7 @@ import type {HostInstance} from 'react-native';
import isUnreachable from '../../../__tests__/utilities/isUnreachable';
import {createShadowNodeReferenceCountingRef} from '../../../__tests__/utilities/ShadowNodeReferenceCounter';
import {getNodeFromPublicInstance} from '../../../../../Libraries/ReactPrivate/ReactNativePrivateInterface';
import {getNodeFromPublicInstance} from '../../../../../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
import VirtualView, {_logs, VirtualViewMode} from '../VirtualView';
import * as Fantom from '@react-native/fantom';
import nullthrows from 'nullthrows';
+2 -4
View File
@@ -14,10 +14,8 @@
// react-native/react-private-interface
//
// This is a private entry point allowing React to require React Native
// internals (previously, Libaries/ReactNativePrivateInterface.js).
//
// These APIs should ONLY be used by first party React internals and are not
// part of our public API.
// internals. These APIs should ONLY be used by first party React internals and
// are not part of our public API.
//
// IMPORTANT: Keep this file in sync with react-private-interface.js.flow.
// ----------------------------------------------------------------------------