Stop using paperComponentName in React Native core component specs - #58188
Open
christophpurrer wants to merge 1 commit into
Open
Stop using paperComponentName in React Native core component specs#58188christophpurrer wants to merge 1 commit into
paperComponentName in React Native core component specs#58188christophpurrer wants to merge 1 commit into
Conversation
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
|
@christophpurrer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D117877024. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
paperComponentNameis acodegenNativeComponentoption that makes the generatedview config announce the old-architecture (Paper)
RCT-prefixed ViewManager nameinstead 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:
ActivityIndicatorViewNativeComponent.jsRCTActivityIndicatorView->ActivityIndicatorViewRCTModalHostViewNativeComponent.jsRCTModalHostView->ModalHostViewPullToRefreshViewNativeComponent.jsRCTRefreshControl->PullToRefreshViewRCTSafeAreaViewNativeComponent.jsRCTSafeAreaView->SafeAreaViewSwitchNativeComponent.jsRCTSwitch->SwitchEach new name already resolves natively, so this is a no-op at runtime:
RCTFabricComponentsPlugins.mmand thereact_fabric_component_plugin_providerentries inBUCKare all unprefixed andmatch the spec names exactly. Previously the
RCTprefix was simply stripped againby
componentNameByReactViewName(), which exists only to undo this legacy prefixing.(
IntBufferBatchMountItem), so Android is unaffected.ModalHostViewstill maps viaFabricNameComponentMapping, andSafeAreaViewstill resolves toReactSafeAreaViewManagerthrough the generic"RCT$className"fallback inViewManagerRegistry.PullToRefreshViewandSwitchare Android-excluded.Deliberately out of scope:
react-native-githubstill passpaperComponentName(RCTMapNativeComponent.js,SliderNativeComponent.js, theAdsLWIpreviews, MagicIsland, ...), as dothird-party OSS libraries.
getOptions()does not validate keys, so removing supportwould silently resolve those components to an unregistered name instead of erroring.
RCTInputAccessoryViewNativeComponent.jskeeps the option, where it isload-bearing: the spec name is
InputAccessorybut the C++ComponentNameisInputAccessoryView, so dropping it would fall through toRCTUnimplementedViewComponentView. Aligning those needs a rename of the codegen'dInputAccessoryProps/InputAccessoryEventEmittersymbols in handwritten C++/ObjC.paperComponentNameDeprecated, which still has 6 internal users.paperComponentNamesection of thename_mapping.mddocs isrefreshed in a separate diff, so this one touches no Markdown.
Also updates the
RCTSwitchfiber-type checks inReactTreeSerializer.jsto acceptSwitch, mirroring the existing check in its siblingDebugInteractions.js.Snapshot churn is the renamed element names only. The
RCTRefreshControlentries inthe
VirtualizedList/RelayPaginationViewsnapshots are unchanged because they comefrom the hardcoded
packages/jest-preset/jest/mocks/RefreshControl.jsmock, not fromthe view config.
Changelog:
[General][Changed] - Core components (
ActivityIndicatorView,ModalHostView,PullToRefreshView,SafeAreaView,Switch) no longer report legacyRCT-prefixed names in their view configsDifferential Revision: D117877024