mirror of
https://github.com/hanzoai/react.git
synced 2026-09-24 17:02:27 +00:00
[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
This commit is contained in:
+1
-1
@@ -45,7 +45,7 @@ import {
|
||||
ReactFiberErrorDialog,
|
||||
createPublicRootInstance,
|
||||
type PublicRootInstance,
|
||||
} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
|
||||
} from 'react-native/react-private-interface';
|
||||
import {
|
||||
disableLegacyMode,
|
||||
enableDefaultTransitionIndicator,
|
||||
|
||||
@@ -31,7 +31,7 @@ import {runEventsInBatch} from './legacy-events/EventBatching';
|
||||
import {
|
||||
RawEventEmitter,
|
||||
dispatchNativeEvent,
|
||||
} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
|
||||
} from 'react-native/react-private-interface';
|
||||
import {getPublicInstance} from './ReactFiberConfigFabric';
|
||||
import {enableNativeEventTargetEventDispatching} from './ReactNativeFeatureFlags';
|
||||
|
||||
|
||||
@@ -39,7 +39,7 @@ import {
|
||||
type PublicInstance as ReactNativePublicInstance,
|
||||
type PublicTextInstance,
|
||||
type PublicRootInstance,
|
||||
} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
|
||||
} from 'react-native/react-private-interface';
|
||||
import {
|
||||
enableFragmentRefsInstanceHandles,
|
||||
enableFragmentRefsTextNodes,
|
||||
|
||||
@@ -16,7 +16,7 @@ import type {TopLevelType} from './legacy-events/TopLevelEventTypes';
|
||||
import SyntheticEvent from './legacy-events/SyntheticEvent';
|
||||
|
||||
// Module provided by RN:
|
||||
import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
|
||||
import {ReactNativeViewConfigRegistry} from 'react-native/react-private-interface';
|
||||
import accumulateInto from './legacy-events/accumulateInto';
|
||||
import getListener from './ReactNativeGetListener';
|
||||
import forEachAccumulated from './legacy-events/forEachAccumulated';
|
||||
|
||||
@@ -17,7 +17,7 @@ import {
|
||||
import getComponentNameFromType from 'shared/getComponentNameFromType';
|
||||
import {HostComponent} from 'react-reconciler/src/ReactWorkTags';
|
||||
// Module provided by RN:
|
||||
import {getNodeFromPublicInstance} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
|
||||
import {getNodeFromPublicInstance} from 'react-native/react-private-interface';
|
||||
import {getNodeFromInternalInstanceHandle} from './ReactNativePublicCompat';
|
||||
import {getStackByFiberInDevAndProd} from 'react-reconciler/src/ReactFiberComponentStack';
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* TODO: require this in packager, not in React #10932517
|
||||
*/
|
||||
// Module provided by RN:
|
||||
import 'react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore';
|
||||
import 'react-native/setup-env';
|
||||
|
||||
import ResponderEventPlugin from './legacy-events/ResponderEventPlugin';
|
||||
import {
|
||||
|
||||
@@ -9,14 +9,14 @@
|
||||
|
||||
import type {Node} from './ReactNativeTypes';
|
||||
import type {ElementRef, ElementType} from 'react';
|
||||
import type {PublicInstance} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
|
||||
import type {PublicInstance} from 'react-native/react-private-interface';
|
||||
|
||||
// Modules provided by RN:
|
||||
import {
|
||||
getNodeFromPublicInstance,
|
||||
getNativeTagFromPublicInstance,
|
||||
getInternalInstanceHandleFromPublicInstance,
|
||||
} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
|
||||
} from 'react-native/react-private-interface';
|
||||
|
||||
import {
|
||||
findHostInstance,
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
|
||||
module.exports = require('./Libraries/ReactPrivate/ReactNativePrivateInterface');
|
||||
@@ -35,9 +35,9 @@ describe('ReactFabric', () => {
|
||||
React = require('react');
|
||||
StrictMode = React.StrictMode;
|
||||
ReactFabric = require('react-native-renderer/fabric');
|
||||
ReactNativePrivateInterface = require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface');
|
||||
ReactNativePrivateInterface = require('react-native/react-private-interface');
|
||||
createReactNativeComponentClass =
|
||||
require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
|
||||
require('react-native/react-private-interface')
|
||||
.ReactNativeViewConfigRegistry.register;
|
||||
({act, assertConsoleErrorDev} = require('internal-test-utils'));
|
||||
});
|
||||
|
||||
+1
-1
@@ -26,7 +26,7 @@ describe('Fabric FragmentRefs', () => {
|
||||
React = require('react');
|
||||
ReactFabric = require('react-native-renderer/fabric');
|
||||
createReactNativeComponentClass =
|
||||
require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
|
||||
require('react-native/react-private-interface')
|
||||
.ReactNativeViewConfigRegistry.register;
|
||||
({act} = require('internal-test-utils'));
|
||||
View = createReactNativeComponentClass('RCTView', () => ({
|
||||
|
||||
@@ -17,7 +17,7 @@ describe('ReactNativeError', () => {
|
||||
jest.resetModules();
|
||||
|
||||
createReactNativeComponentClass =
|
||||
require('react-native/Libraries/ReactPrivate/ReactNativePrivateInterface')
|
||||
require('react-native/react-private-interface')
|
||||
.ReactNativeViewConfigRegistry.register;
|
||||
});
|
||||
|
||||
|
||||
+2
-2
@@ -54,7 +54,7 @@ declare opaque type __PublicInstance;
|
||||
declare opaque type __PublicTextInstance;
|
||||
declare opaque type __PublicRootInstance;
|
||||
|
||||
declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface' {
|
||||
declare module 'react-native/react-private-interface' {
|
||||
declare export function deepFreezeAndThrowOnMutationInDev<T>(obj: T): T;
|
||||
declare export const ReactFiberErrorDialog: {
|
||||
showErrorDialog: (error: __CapturedError) => boolean,
|
||||
@@ -117,7 +117,7 @@ declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface'
|
||||
): null | Object;
|
||||
}
|
||||
|
||||
declare module 'react-native/Libraries/ReactPrivate/ReactNativePrivateInitializeCore' {
|
||||
declare module 'react-native/setup-env' {
|
||||
}
|
||||
|
||||
declare module 'react-native' {
|
||||
|
||||
@@ -13,13 +13,12 @@ const importSideEffects = Object.freeze({
|
||||
path: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
stream: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
'prop-types/checkPropTypes': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface':
|
||||
HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
scheduler: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
react: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
'react-dom/server': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
'react/jsx-dev-runtime': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
'react-dom': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
'react-native/react-private-interface': HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
url: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
ReactNativeInternalFeatureFlags: HAS_NO_SIDE_EFFECTS_ON_IMPORT,
|
||||
'webpack-sources/lib/helpers/createMappingsSerializer.js':
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import {BatchedBridge} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
|
||||
import {BatchedBridge} from 'react-native/react-private-interface';
|
||||
|
||||
import type {ReactFabricType} from './ReactNativeTypes';
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
'use strict';
|
||||
|
||||
import {ReactNativeViewConfigRegistry} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';
|
||||
import {ReactNativeViewConfigRegistry} from 'react-native/react-private-interface';
|
||||
import {type ViewConfig} from './ReactNativeTypes';
|
||||
|
||||
const {register} = ReactNativeViewConfigRegistry;
|
||||
|
||||
Reference in New Issue
Block a user