@samitouri / QOS-React / commits / 96fcba9013

[RN] Update ReactPrivate and InitializeCore imports (0.87 Strict API) (#36986)

## Summary Migrate internal `Libraries/` import subpaths from `react-native` to the incoming dedicated entry points in React Native 0.87. **Motivation** See [**RFC0894: Removing deep imports from react-native**](https://github.com/react-native-community/discussions-and-proposals/pull/894) **Changes** The `react-private-interface` entry point has been created explicitly for the private contract between React ↔ React Native, and is 1:1 with the previous `ReactNativePrivateInterface` module. Both of the below `Libraries/` paths still exist, but are deprecated — this is a lagging migration that will enable cleanup in a future RN version. - `react-native/Libraries/Core/InitializeCore` → `react-native/setup-env` [react/react-native#57475](https://github.com/react/react-native/pull/57475) - `react-native/Libraries/ReactPrivate/ReactNativePrivateInterface` → `react-native/react-private-interface` [react/react-native#57495](https://github.com/react/react-native/pull/57495) ## Test Plan Flow

Alex Hunt committed Jul 28, 2026 at 16:45 UTC 96fcba90138e9f1a73ee1cc4f79a653ec12fc3a9
16 files changed +27 -18
packages/react-native-renderer/src/ReactFabric.js
+1 -1
@@ -45,7 +45,7 @@ import {
45 ReactFiberErrorDialog,
46 createPublicRootInstance,
47 type PublicRootInstance,
48 -} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
48 +} from 'react-native/react-private-interface';
49 import {
50 disableLegacyMode,
51 enableDefaultTransitionIndicator,
packages/react-native-renderer/src/ReactFabricEventEmitter.js
+1 -1
@@ -31,7 +31,7 @@ import {runEventsInBatch} from './legacy-events/EventBatching';
31 import {
32 RawEventEmitter,
33 dispatchNativeEvent,
34 -} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
34 +} from 'react-native/react-private-interface';
35 import {getPublicInstance} from './ReactFiberConfigFabric';
36 import {enableNativeEventTargetEventDispatching} from './ReactNativeFeatureFlags';
37
packages/react-native-renderer/src/ReactFiberConfigFabric.js
+1 -1
@@ -39,7 +39,7 @@ import {
39 type PublicInstance as ReactNativePublicInstance,
40 type PublicTextInstance,
41 type PublicRootInstance,
42 -} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
42 +} from 'react-native/react-private-interface';
43 import {
44 enableFragmentRefsInstanceHandles,
45 enableFragmentRefsTextNodes,
packages/react-native-renderer/src/ReactNativeBridgeEventPlugin.js
+1 -1
@@ -16,7 +16,7 @@ import type {TopLevelType} from './legacy-events/TopLevelEventTypes';
16 import SyntheticEvent from './legacy-events/SyntheticEvent';
17
18 // Module provided by RN:
19 -import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
19 +import {ReactNativeViewConfigRegistry} from 'react-native/react-private-interface';
20 import accumulateInto from './legacy-events/accumulateInto';
21 import getListener from './ReactNativeGetListener';
22 import forEachAccumulated from './legacy-events/forEachAccumulated';
packages/react-native-renderer/src/ReactNativeFiberInspector.js
+1 -1
@@ -17,7 +17,7 @@ import {
17 import getComponentNameFromType from 'shared/getComponentNameFromType';
18 import {HostComponent} from 'react-reconciler/src/ReactWorkTags';
19 // Module provided by RN:
20 -import {getNodeFromPublicInstance} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
20 +import {getNodeFromPublicInstance} from 'react-native/react-private-interface';
21 import {getNodeFromInternalInstanceHandle} from './ReactNativePublicCompat';
22 import {getStackByFiberInDevAndProd} from 'react-reconciler/src/ReactFiberComponentStack';
23
packages/react-native-renderer/src/ReactNativeInjectionShared.js
+1 -1
@@ -14,7 +14,7 @@
14 * TODO: require this in packager, not in React #10932517
15 */
16 // Module provided by RN:
17 -import 'react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore';
17 +import 'react-native/setup-env';
18
19 import ResponderEventPlugin from './legacy-events/ResponderEventPlugin';
20 import {
packages/react-native-renderer/src/ReactNativePublicCompat.js
+2 -2
@@ -9,14 +9,14 @@
9
10 import type {Node} from './ReactNativeTypes';
11 import type {ElementRef, ElementType} from 'react';
12 -import type {PublicInstance} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
12 +import type {PublicInstance} from 'react-native/react-private-interface';
13
14 // Modules provided by RN:
15 import {
16 getNodeFromPublicInstance,
17 getNativeTagFromPublicInstance,
18 getInternalInstanceHandleFromPublicInstance,
19 -} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
19 +} from 'react-native/react-private-interface';
20
21 import {
22 findHostInstance,
packages/react-native-renderer/src/__mocks__/react-native/react-private-interface.js new
+10
@@ -0,0 +1,10 @@
1 +/**
2 + * Copyright (c) Meta Platforms, Inc. and affiliates.
3 + *
4 + * This source code is licensed under the MIT license found in the
5 + * LICENSE file in the root directory of this source tree.
6 + *
7 + * @flow strict-local
8 + */
9 +
10 +module.exports = require('./Libraries/ReactPrivate/ReactNativePrivateInterface');
packages/react-native-renderer/src/__mocks__/react-native/setup-env.js renamed
packages/react-native-renderer/src/__tests__/ReactFabric-test.internal.js
+2 -2
@@ -35,9 +35,9 @@ describe('ReactFabric', () => {
35 React = require('react');
36 StrictMode = React.StrictMode;
37 ReactFabric = require('react-native-renderer/fabric');
38 - ReactNativePrivateInterface = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface');
38 + ReactNativePrivateInterface = require('react-native/react-private-interface');
39 createReactNativeComponentClass =
40 - require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
40 + require('react-native/react-private-interface')
41 .ReactNativeViewConfigRegistry.register;
42 ({act, assertConsoleErrorDev} = require('internal-test-utils'));
43 });
packages/react-native-renderer/src/__tests__/ReactFabricFragmentRefs-test.internal.js
+1 -1
@@ -26,7 +26,7 @@ describe('Fabric FragmentRefs', () => {
26 React = require('react');
27 ReactFabric = require('react-native-renderer/fabric');
28 createReactNativeComponentClass =
29 - require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
29 + require('react-native/react-private-interface')
30 .ReactNativeViewConfigRegistry.register;
31 ({act} = require('internal-test-utils'));
32 View = createReactNativeComponentClass('RCTView', () => ({
packages/react-native-renderer/src/__tests__/ReactNativeError-test.internal.js
+1 -1
@@ -17,7 +17,7 @@ describe('ReactNativeError', () => {
17 jest.resetModules();
18
19 createReactNativeComponentClass =
20 - require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
20 + require('react-native/react-private-interface')
21 .ReactNativeViewConfigRegistry.register;
22 });
23
scripts/flow/react-native-host-hooks.js
+2 -2
@@ -54,7 +54,7 @@ declare opaque type __PublicInstance;
54 declare opaque type __PublicTextInstance;
55 declare opaque type __PublicRootInstance;
56
57 -declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface' {
57 +declare module 'react-native/react-private-interface' {
58 declare export function deepFreezeAndThrowOnMutationInDev<T>(obj: T): T;
59 declare export const ReactFiberErrorDialog: {
60 showErrorDialog: (error: __CapturedError) => boolean,
@@ -117,7 +117,7 @@ declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface'
117 ): null | Object;
118 }
119
120 -declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore' {
120 +declare module 'react-native/setup-env' {
121 }
122
123 declare module 'react-native' {
scripts/rollup/modules.js
+1 -2
@@ -13,13 +13,12 @@ const importSideEffects = Object.freeze({
13 path: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
14 stream: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
15 'prop-types/checkPropTypes': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
16 - 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface':
17 - HAS_NO_SIDE_EFFECTS_ON_IMPORT,
16 scheduler: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
17 react: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
18 'react-dom/server': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
19 'react/jsx-dev-runtime': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
20 'react-dom': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
21 + 'react-native/react-private-interface': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
22 url: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
23 ReactNativeInternalFeatureFlags: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
24 'webpack-sources/lib/helpers/createMappingsSerializer.js':
scripts/rollup/shims/react-native/ReactFabric.js
+1 -1
@@ -11,7 +11,7 @@
11
12 'use strict';
13
14 -import {BatchedBridge} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
14 +import {BatchedBridge} from 'react-native/react-private-interface';
15
16 import type {ReactFabricType} from './ReactNativeTypes';
17
scripts/rollup/shims/react-native/createReactNativeComponentClass.js
+1 -1
@@ -11,7 +11,7 @@
11
12 'use strict';
13
14 -import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
14 +import {ReactNativeViewConfigRegistry} from 'react-native/react-private-interface';
15 import {type ViewConfig} from './ReactNativeTypes';
16
17 const {register} = ReactNativeViewConfigRegistry;