mirror of
https://github.com/facebook/react-native.git
synced 2026-11-18 20:19:07 +00:00
Remove unused bindings from the React private interface (#58455)
Summary: Pull Request resolved: https://github.com/react/react-native/pull/58455 `react-native/react-private-interface` still exposed a number of values that no version of the renderer reads anymore. Checking every binding against the whole of `Libraries/Renderer` (the Fabric bundles and the shims) shows that `ExceptionsManager`, `Platform`, `RCTEventEmitter`, `TextInputState`, `deepDiffer`, `flattenStyle`, `legacySendAccessibilityEvent` and `CustomEvent` have no reference left — most of them were only ever needed by the legacy renderer bundles, which no longer exist. Remove those getters, along with the `import typeof` declarations that became unused (including the `DangerouslyImpreciseStyleProp` type that only `flattenStyle` needed) and the two `TODO` comments attached to `deepDiffer` and `flattenStyle`. The modules themselves are untouched and stay reachable through their normal entry points. `react-private-interface.js.flow` is updated to match. Changelog: [Internal] Reviewed By: christophpurrer Differential Revision: D119500025 fbshipit-source-id: 750926dfc8e70395c489b10fde5cc3c08de99672
This commit is contained in:
1 parent
309d1a6f12
commit
7754512bd1
2 files changed
-46
No files matched your search
@@ -21,12 +21,8 @@
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
import typeof BatchedBridge from '../Libraries/BatchedBridge/BatchedBridge';
|
||||
import typeof legacySendAccessibilityEvent from '../Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent';
|
||||
import typeof TextInputState from '../Libraries/Components/TextInput/TextInputState';
|
||||
import typeof ExceptionsManager from '../Libraries/Core/ExceptionsManager';
|
||||
import typeof RawEventEmitter from '../Libraries/Core/RawEventEmitter';
|
||||
import typeof ReactFiberErrorDialog from '../Libraries/Core/ReactFiberErrorDialog';
|
||||
import typeof RCTEventEmitter from '../Libraries/EventEmitter/RCTEventEmitter';
|
||||
import type {Spec as FabricUIManager} from '../Libraries/ReactNative/FabricUIManager';
|
||||
import typeof {
|
||||
createPublicInstance,
|
||||
@@ -41,14 +37,9 @@ import typeof {
|
||||
diff as diffAttributePayloads,
|
||||
} from '../Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload';
|
||||
import typeof * as ReactNativeViewConfigRegistry from '../Libraries/Renderer/shims/ReactNativeViewConfigRegistry';
|
||||
import typeof flattenStyle from '../Libraries/StyleSheet/flattenStyle';
|
||||
import type {DangerouslyImpreciseStyleProp} from '../Libraries/StyleSheet/StyleSheet';
|
||||
import typeof deepFreezeAndThrowOnMutationInDev from '../Libraries/Utilities/deepFreezeAndThrowOnMutationInDev';
|
||||
import typeof deepDiffer from '../Libraries/Utilities/differ/deepDiffer';
|
||||
import typeof Platform from '../Libraries/Utilities/Platform';
|
||||
import typeof * as ReactNativeFeatureFlags from './private/featureflags/ReactNativeFeatureFlags';
|
||||
import typeof dispatchNativeEvent from './private/renderer/events/dispatchNativeEvent';
|
||||
import typeof CustomEvent from './private/webapis/dom/events/CustomEvent';
|
||||
|
||||
export type {PublicRootInstance} from '../Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance';
|
||||
export type PublicTextInstance = ReturnType<createPublicTextInstance>;
|
||||
@@ -59,56 +50,27 @@ module.exports = {
|
||||
get BatchedBridge(): BatchedBridge {
|
||||
return require('../Libraries/BatchedBridge/BatchedBridge').default;
|
||||
},
|
||||
get ExceptionsManager(): ExceptionsManager {
|
||||
return require('../Libraries/Core/ExceptionsManager').default;
|
||||
},
|
||||
get Platform(): Platform {
|
||||
return require('../Libraries/Utilities/Platform').default;
|
||||
},
|
||||
get RCTEventEmitter(): RCTEventEmitter {
|
||||
return require('../Libraries/EventEmitter/RCTEventEmitter').default;
|
||||
},
|
||||
get ReactNativeFeatureFlags(): ReactNativeFeatureFlags {
|
||||
return require('./private/featureflags/ReactNativeFeatureFlags');
|
||||
},
|
||||
get ReactNativeViewConfigRegistry(): ReactNativeViewConfigRegistry {
|
||||
return require('../Libraries/Renderer/shims/ReactNativeViewConfigRegistry');
|
||||
},
|
||||
get TextInputState(): TextInputState {
|
||||
return require('../Libraries/Components/TextInput/TextInputState').default;
|
||||
},
|
||||
get fabricUIManager(): ?FabricUIManager {
|
||||
return require('../Libraries/ReactNative/FabricUIManager').getFabricUIManager();
|
||||
},
|
||||
// TODO: Remove when React has migrated to `createAttributePayload` and `diffAttributePayloads`
|
||||
get deepDiffer(): deepDiffer {
|
||||
return require('../Libraries/Utilities/differ/deepDiffer').default;
|
||||
},
|
||||
get deepFreezeAndThrowOnMutationInDev(): deepFreezeAndThrowOnMutationInDev<
|
||||
{...} | Array<unknown>,
|
||||
> {
|
||||
return require('../Libraries/Utilities/deepFreezeAndThrowOnMutationInDev')
|
||||
.default;
|
||||
},
|
||||
// TODO: Remove when React has migrated to `createAttributePayload` and `diffAttributePayloads`
|
||||
get flattenStyle(): flattenStyle<DangerouslyImpreciseStyleProp> {
|
||||
// $FlowFixMe[underconstrained-implicit-instantiation]
|
||||
// $FlowFixMe[incompatible-type]
|
||||
return require('../Libraries/StyleSheet/flattenStyle').default;
|
||||
},
|
||||
get ReactFiberErrorDialog(): ReactFiberErrorDialog {
|
||||
return require('../Libraries/Core/ReactFiberErrorDialog').default;
|
||||
},
|
||||
get legacySendAccessibilityEvent(): legacySendAccessibilityEvent {
|
||||
return require('../Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent')
|
||||
.default;
|
||||
},
|
||||
get RawEventEmitter(): RawEventEmitter {
|
||||
return require('../Libraries/Core/RawEventEmitter').default;
|
||||
},
|
||||
get CustomEvent(): CustomEvent {
|
||||
return require('./private/webapis/dom/events/CustomEvent').default;
|
||||
},
|
||||
get createAttributePayload(): createAttributePayload {
|
||||
return require('../Libraries/ReactNative/ReactFabricPublicInstance/ReactNativeAttributePayload')
|
||||
.create;
|
||||
|
||||
@@ -21,20 +21,12 @@ export type {PublicRootInstance} from '../Libraries/ReactNative/ReactFabricPubli
|
||||
export type PublicTextInstance = ReturnType<createPublicTextInstanceT>;
|
||||
|
||||
export {default as BatchedBridge} from '../Libraries/BatchedBridge/BatchedBridge';
|
||||
export {default as ExceptionsManager} from '../Libraries/Core/ExceptionsManager';
|
||||
export {default as Platform} from '../Libraries/Utilities/Platform';
|
||||
export {default as RCTEventEmitter} from '../Libraries/EventEmitter/RCTEventEmitter';
|
||||
export * as ReactNativeFeatureFlags from './private/featureflags/ReactNativeFeatureFlags';
|
||||
export * as ReactNativeViewConfigRegistry from '../Libraries/Renderer/shims/ReactNativeViewConfigRegistry';
|
||||
export {default as TextInputState} from '../Libraries/Components/TextInput/TextInputState';
|
||||
declare export const fabricUIManager: ?FabricUIManager;
|
||||
export {default as deepDiffer} from '../Libraries/Utilities/differ/deepDiffer';
|
||||
export {default as deepFreezeAndThrowOnMutationInDev} from '../Libraries/Utilities/deepFreezeAndThrowOnMutationInDev';
|
||||
export {default as flattenStyle} from '../Libraries/StyleSheet/flattenStyle';
|
||||
export {default as ReactFiberErrorDialog} from '../Libraries/Core/ReactFiberErrorDialog';
|
||||
export {default as legacySendAccessibilityEvent} from '../Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent';
|
||||
export {default as RawEventEmitter} from '../Libraries/Core/RawEventEmitter';
|
||||
export {default as CustomEvent} from './private/webapis/dom/events/CustomEvent';
|
||||
export {
|
||||
create as createAttributePayload,
|
||||
diff as diffAttributePayloads,
|
||||
|
||||
Reference in new issue
Block a user