Skip to content

Commit aefa45f

Browse files
committed
accessibility TtsSpan examples
1 parent 7b85e25 commit aefa45f

File tree

3 files changed

+834
-7
lines changed

3 files changed

+834
-7
lines changed

packages/rn-tester/js/examples/Accessibility/AccessibilityExample.js

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,91 @@ class AccessibilityExample extends React.Component<{}> {
9090
render(): React.Node {
9191
return (
9292
<View>
93+
<RNTesterBlock title="Text with TtsSpan">
94+
<View>
95+
<Text accessible={true}>
96+
My number is{' '}
97+
<Text
98+
accessibilityRole="decimal"
99+
accessible={true}
100+
style={{backgroundColor: 'red'}}>
101+
10.20
102+
</Text>
103+
.
104+
</Text>
105+
</View>
106+
<View>
107+
<Text accessible={true}>
108+
My number is{' '}
109+
<Text
110+
accessibilityRole="decimal"
111+
accessible={true}
112+
style={{backgroundColor: 'red'}}>
113+
10$
114+
</Text>
115+
</Text>
116+
</View>
117+
<View>
118+
<Text accessible={true}>
119+
My number is{' '}
120+
<Text
121+
accessibilityRole="time"
122+
accessible={true}
123+
style={{backgroundColor: 'red'}}>
124+
17:00
125+
</Text>
126+
</Text>
127+
</View>
128+
<View>
129+
<Text accessible={true} accessibilityRole="telephone">
130+
My number is 0111234234234
131+
</Text>
132+
</View>
133+
<View>
134+
<Text accessible={true}>
135+
My number is{' '}
136+
<Text
137+
accessibilityRole="date"
138+
accessible={true}
139+
style={{backgroundColor: 'red'}}>
140+
02/07/1987
141+
</Text>
142+
</Text>
143+
</View>
144+
<View>
145+
<Text accessible={true}>
146+
My number is{' '}
147+
<Text
148+
accessibilityRole="measure"
149+
accessible={true}
150+
style={{backgroundColor: 'red'}}>
151+
10m
152+
</Text>
153+
</Text>
154+
</View>
155+
<View>
156+
<Text accessible={true}>
157+
My number is{' '}
158+
<Text
159+
accessibilityRole="fraction"
160+
accessible={true}
161+
style={{backgroundColor: 'red'}}>
162+
1/2
163+
</Text>
164+
</Text>
165+
</View>
166+
<View>
167+
<Text accessible={true}>
168+
It spells like{' '}
169+
<Text
170+
accessibilityRole="verbatim"
171+
accessible={true}
172+
style={{backgroundColor: 'red'}}>
173+
reactnative
174+
</Text>
175+
</Text>
176+
</View>
177+
</RNTesterBlock>
93178
<RNTesterBlock title="TextView without label">
94179
<Text>
95180
Text's accessibilityLabel is the raw text itself unless it is set

packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,27 @@ import {useState} from 'react';
1414

1515
export default function TextAdjustsDynamicLayoutExample(props: {}): React.Node {
1616
const [height, setHeight] = useState(20);
17+
1718
return (
1819
<>
1920
<View>
20-
<Text accessibilityRole="date" accessible={true}>
21-
My number is{' '}
22-
<Text accessible={true} style={{backgroundColor: 'red'}}>
23-
02/07/1987
21+
<View style={[styles.subjectContainer, {height}]}>
22+
<Text
23+
adjustsFontSizeToFit={true}
24+
numberOfLines={1}
25+
style={styles.subjectText}>
26+
This is adjusting text.
2427
</Text>
25-
.
26-
</Text>
28+
</View>
29+
</View>
30+
<View style={styles.row}>
31+
<Button onPress={() => setHeight(20)} title="Set Height to 20" />
32+
</View>
33+
<View style={styles.row}>
34+
<Button onPress={() => setHeight(40)} title="Set Height to 40" />
35+
</View>
36+
<View style={styles.row}>
37+
<Button onPress={() => setHeight(60)} title="Set Height to 60" />
2738
</View>
2839
</>
2940
);

0 commit comments

Comments
 (0)