Skip to content

Commit d6d7bc2

Browse files
Stop using paperComponentName in React Native core component specs
Summary: `paperComponentName` is a `codegenNativeComponent` option that makes the generated view config announce the old-architecture (Paper) `RCT`-prefixed ViewManager name instead of the component's own name. We no longer support the old architecture, so core components should announce their real Fabric names. Removes the option from the five core specs where it is provably redundant: | Spec | Name in view config | |---|---| | `ActivityIndicatorViewNativeComponent.js` | `RCTActivityIndicatorView` -> `ActivityIndicatorView` | | `RCTModalHostViewNativeComponent.js` | `RCTModalHostView` -> `ModalHostView` | | `PullToRefreshViewNativeComponent.js` | `RCTRefreshControl` -> `PullToRefreshView` | | `RCTSafeAreaViewNativeComponent.js` | `RCTSafeAreaView` -> `SafeAreaView` | | `SwitchNativeComponent.js` | `RCTSwitch` -> `Switch` | Each new name already resolves natively, so this is a no-op at runtime: - **iOS Fabric** — the plugin keys in `RCTFabricComponentsPlugins.mm` and the `react_fabric_component_plugin_provider` entries in `BUCK` are all unprefixed and match the spec names exactly. Previously the `RCT` prefix was simply stripped again by `componentNameByReactViewName()`, which exists only to undo this legacy prefixing. - **Android Fabric** — mount items carry the C++ descriptor name, not the JS name (`IntBufferBatchMountItem`), so Android is unaffected. `ModalHostView` still maps via `FabricNameComponentMapping`, and `SafeAreaView` still resolves to `ReactSafeAreaViewManager` through the generic `"RCT$className"` fallback in `ViewManagerRegistry`. `PullToRefreshView` and `Switch` are Android-excluded. Deliberately out of scope: - **The codegen option itself is retained.** 24 Meta-internal specs outside `react-native-github` still pass `paperComponentName` (`RCTMapNativeComponent.js`, `SliderNativeComponent.js`, the `AdsLWI` previews, MagicIsland, ...), as do third-party OSS libraries. `getOptions()` does not validate keys, so removing support would silently resolve those components to an unregistered name instead of erroring. - **`RCTInputAccessoryViewNativeComponent.js` keeps the option**, where it is load-bearing: the spec name is `InputAccessory` but the C++ `ComponentName` is `InputAccessoryView`, so dropping it would fall through to `RCTUnimplementedViewComponentView`. Aligning those needs a rename of the codegen'd `InputAccessoryProps`/`InputAccessoryEventEmitter` symbols in handwritten C++/ObjC. - **`paperComponentNameDeprecated`**, which still has 6 internal users. - **Documentation.** The `paperComponentName` section of the `name_mapping.md` docs is refreshed in a separate diff, so this one touches no Markdown. Also updates the `RCTSwitch` fiber-type checks in `ReactTreeSerializer.js` to accept `Switch`, mirroring the existing check in its sibling `DebugInteractions.js`. Snapshot churn is the renamed element names only. The `RCTRefreshControl` entries in the `VirtualizedList`/`RelayPaginationView` snapshots are unchanged because they come from the hardcoded `packages/jest-preset/jest/mocks/RefreshControl.js` mock, not from the view config. ## Changelog: [General][Changed] - Core components (`ActivityIndicatorView`, `ModalHostView`, `PullToRefreshView`, `SafeAreaView`, `Switch`) no longer report legacy `RCT`-prefixed names in their view configs Differential Revision: D117877024
1 parent c6b137c commit d6d7bc2

6 files changed

Lines changed: 6 additions & 13 deletions

File tree

packages/react-native/Libraries/LogBox/__tests__/__snapshots__/LogBoxNotificationContainer-test.js.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`LogBoxNotificationContainer should render both an error and warning notification 1`] = `
4-
<RCTSafeAreaView
4+
<SafeAreaView
55
style={
66
Object {
77
"bottom": 20,
@@ -101,7 +101,7 @@ exports[`LogBoxNotificationContainer should render both an error and warning not
101101
totalLogCount={1}
102102
/>
103103
</View>
104-
</RCTSafeAreaView>
104+
</SafeAreaView>
105105
`;
106106

107107
exports[`LogBoxNotificationContainer should render null with no logs 1`] = `null`;
@@ -113,7 +113,7 @@ exports[`LogBoxNotificationContainer should render selected fatal error even whe
113113
exports[`LogBoxNotificationContainer should render selected syntax error even when disabled 1`] = `null`;
114114

115115
exports[`LogBoxNotificationContainer should render the latest error notification 1`] = `
116-
<RCTSafeAreaView
116+
<SafeAreaView
117117
style={
118118
Object {
119119
"bottom": 20,
@@ -168,11 +168,11 @@ exports[`LogBoxNotificationContainer should render the latest error notification
168168
totalLogCount={2}
169169
/>
170170
</View>
171-
</RCTSafeAreaView>
171+
</SafeAreaView>
172172
`;
173173

174174
exports[`LogBoxNotificationContainer should render the latest warning notification 1`] = `
175-
<RCTSafeAreaView
175+
<SafeAreaView
176176
style={
177177
Object {
178178
"bottom": 20,
@@ -227,5 +227,5 @@ exports[`LogBoxNotificationContainer should render the latest warning notificati
227227
totalLogCount={2}
228228
/>
229229
</View>
230-
</RCTSafeAreaView>
230+
</SafeAreaView>
231231
`;

packages/react-native/src/private/components/activityindicator/specs/ActivityIndicatorViewNativeComponent.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,4 @@ type RCTActivityIndicatorViewNativeProps = Readonly<{
5050

5151
export default codegenNativeComponent<RCTActivityIndicatorViewNativeProps>(
5252
'ActivityIndicatorView',
53-
{
54-
paperComponentName: 'RCTActivityIndicatorView',
55-
},
5653
) as HostComponent<RCTActivityIndicatorViewNativeProps>;

packages/react-native/src/private/components/modal/specs/RCTModalHostViewNativeComponent.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,5 @@ export default codegenNativeComponent<RCTModalHostViewNativeProps>(
146146
'ModalHostView',
147147
{
148148
interfaceOnly: true,
149-
paperComponentName: 'RCTModalHostView',
150149
},
151150
) as HostComponent<RCTModalHostViewNativeProps>;

packages/react-native/src/private/components/refreshcontrol/specs/PullToRefreshViewNativeComponent.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,6 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
6868
export default codegenNativeComponent<PullToRefreshNativeProps>(
6969
'PullToRefreshView',
7070
{
71-
paperComponentName: 'RCTRefreshControl',
7271
excludedPlatforms: ['android'],
7372
},
7473
) as HostComponent<PullToRefreshNativeProps>;

packages/react-native/src/private/components/safeareaview/specs/RCTSafeAreaViewNativeComponent.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ type RCTSafeAreaViewNativeProps = Readonly<{
2222
export default codegenNativeComponent<RCTSafeAreaViewNativeProps>(
2323
'SafeAreaView',
2424
{
25-
paperComponentName: 'RCTSafeAreaView',
2625
interfaceOnly: true,
2726
},
2827
) as HostComponent<RCTSafeAreaViewNativeProps>;

packages/react-native/src/private/components/switch/specs/SwitchNativeComponent.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export const Commands: NativeCommands = codegenNativeCommands<NativeCommands>({
5959
});
6060

6161
export default codegenNativeComponent<SwitchNativeProps>('Switch', {
62-
paperComponentName: 'RCTSwitch',
6362
excludedPlatforms: ['android'],
6463
interfaceOnly: true,
6564
}) as ComponentType;

0 commit comments

Comments
 (0)