MCPcopy Index your code
hub / github.com/callstack/react-native-testing-library / getTextContent

Function getTextContent

src/helpers/text-content.ts:3–18  ·  view source on GitHub ↗
(instance: TestInstance | string | null)

Source from the content-addressed store, hash-verified

1import type { TestInstance } from 'test-renderer';
2
3export function getTextContent(instance: TestInstance | string | null): string {
4 if (!instance) {
5 return '';
6 }
7
8 if (typeof instance === 'string') {
9 return instance;
10 }
11
12 const result: string[] = [];
13 instance.children?.forEach((child) => {
14 result.push(getTextContent(child));
15 });
16
17 return result.join('');
18}

Callers 4

computeAriaLabelFunction · 0.90
matchTextContentFunction · 0.90
toHaveTextContentFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…