Skip to content

Restore paperComponentName: 'RCTSwitch' to fix @testing-library/react-native queries - #58323

Open
christophpurrer wants to merge 1 commit into
react:mainfrom
christophpurrer:export-D118743290
Open

Restore paperComponentName: 'RCTSwitch' to fix @testing-library/react-native queries#58323
christophpurrer wants to merge 1 commit into
react:mainfrom
christophpurrer:export-D118743290

Conversation

@christophpurrer

Copy link
Copy Markdown
Contributor

Summary:
Restore paperComponentName: 'RCTSwitch' in SwitchNativeComponent.js and regenerate affected snapshots to fix test breakages introduced by D117877024.

testing-library/react-native 13.3.3 hardcodes HOST_SWITCH_NAMES = ['RCTSwitch'], so renaming the component to Switch broke getByRole('switch') queries and toBeChecked() assertions. This was the only xplat/js-wide breakage from that diff—only bare <Switch> renders without explicit accessible props failed, and only in TWInternBoolSettingComponent-test.js.

Add an inline comment documenting the testing-library/react-native constraint to prevent future regressions. The four other component renames in D117877024 have no RNTL special-casing and remain as landed.

Changelog: [iOS][Fixed] Restore paperComponentName: 'RCTSwitch' to fix testing-library/react-native queries

Differential Revision: D118743290

…act-native` queries

Summary:
Restore `paperComponentName: 'RCTSwitch'` in `SwitchNativeComponent.js` and regenerate affected snapshots to fix test breakages introduced by D117877024.

`testing-library/react-native` 13.3.3 hardcodes `HOST_SWITCH_NAMES = ['RCTSwitch']`, so renaming the component to `Switch` broke `getByRole('switch')` queries and `toBeChecked()` assertions. This was the only xplat/js-wide breakage from that diff—only bare `<Switch>` renders without explicit `accessible` props failed, and only in `TWInternBoolSettingComponent-test.js`.

Add an inline comment documenting the `testing-library/react-native` constraint to prevent future regressions. The four other component renames in D117877024 have no RNTL special-casing and remain as landed.

Changelog: [iOS][Fixed] Restore `paperComponentName: 'RCTSwitch'` to fix `testing-library/react-native` queries

Differential Revision: D118743290
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 4, 2026
@meta-codesync

meta-codesync Bot commented Sep 4, 2026

Copy link
Copy Markdown

@christophpurrer has exported this pull request. If you are a Meta employee, you can view the originating Diff in D118743290.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. meta-exported p: Facebook Partner: Facebook Partner

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant