Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/__tests__/host-component-names.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,13 @@ test('detects host Switch component', async () => {
expect(isHostSwitch(screen.root)).toBe(true);
});

// The iOS native component spec codegens under the name `Switch`, so the bare
// name has to be recognised alongside the legacy `RCTSwitch` one.
test('detects raw Switch component', async () => {
await render(React.createElement('Switch', { testID: 'switch' }));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does render? RCTSwitch? In real code how do you access that Switch with out RCT prefix?

expect(isHostSwitch(screen.root)).toBe(true);
});

test('detects host ScrollView component', async () => {
await render(<ScrollView />);
expect(isHostScrollView(screen.root)).toBe(true);
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/host-component-names.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { TestInstance } from 'test-renderer';
export const HOST_TEXT_NAMES = ['Text', 'RCTText'];
const HOST_TEXT_INPUT_NAMES = ['TextInput'];
const HOST_IMAGE_NAMES = ['Image'];
const HOST_SWITCH_NAMES = ['RCTSwitch'];
const HOST_SWITCH_NAMES = ['Switch', 'RCTSwitch'];
const HOST_SCROLL_VIEW_NAMES = ['RCTScrollView'];
const HOST_MODAL_NAMES = ['Modal'];

Expand Down