Skip to content

Commit 8373d6a

Browse files
chore: add accessibility experiments (#1489)
1 parent b313660 commit 8373d6a

File tree

2 files changed

+86
-0
lines changed

2 files changed

+86
-0
lines changed

experiments-app/src/experiments.ts

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { AccessibilityScreen } from './screens/Accessibility';
12
import { TextInputEventPropagation } from './screens/TextInputEventPropagation';
23
import { TextInputEvents } from './screens/TextInputEvents';
34
import { ScrollViewEvents } from './screens/ScrollViewEvents';
@@ -7,6 +8,11 @@ import { SectionListEvents } from './screens/SectionListEvents';
78
export type Experiment = (typeof experiments)[number];
89

910
export const experiments = [
11+
{
12+
key: 'Accessibility',
13+
title: 'Accessibility',
14+
component: AccessibilityScreen,
15+
},
1016
{
1117
key: 'TextInputEvents',
1218
title: 'TextInput Events',
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import * as React from 'react';
2+
import { StyleSheet, View, Text, ScrollView, TextInput } from 'react-native';
3+
4+
export function AccessibilityScreen() {
5+
return (
6+
<ScrollView style={styles.container}>
7+
<View style={styles.view}>
8+
<Text accessible={false}>{'<View />'}</Text>
9+
</View>
10+
<View accessible style={styles.view}>
11+
<Text accessible={false}>{'<View accessible />'}</Text>
12+
</View>
13+
<View role="button" style={styles.view}>
14+
<Text accessible={false}>{'<View role="button" />'}</Text>
15+
</View>
16+
<View accessible role="button" style={styles.view}>
17+
<Text accessible={false}>{'<View accessible role="button" />'}</Text>
18+
</View>
19+
<View accessible role="slider" style={styles.view}>
20+
<Text accessible={false}>{'<View accessible role="slider" />'}</Text>
21+
</View>
22+
<View accessible role="none" style={styles.view}>
23+
<Text accessible={false}>{'<View accessible role="none" />'}</Text>
24+
</View>
25+
26+
<Text style={styles.text}>{'<Text />'}</Text>
27+
<Text accessible={false} style={styles.text}>
28+
{'<Text accessible={false} />'}
29+
</Text>
30+
<Text role="none" style={styles.text}>
31+
{'<Text role="none" />'}
32+
</Text>
33+
34+
<TextInput style={styles.textInput} value="<TextInput />" />
35+
<TextInput
36+
editable={false}
37+
style={styles.textInput}
38+
value="<TextInput editable={false} />"
39+
/>
40+
<TextInput
41+
accessibilityRole="search"
42+
style={styles.textInput}
43+
value="<TextInput accessibilityRole='search' />"
44+
/>
45+
<TextInput
46+
role="searchbox"
47+
style={styles.textInput}
48+
value="<TextInput role='search' />"
49+
/>
50+
<TextInput
51+
role="none"
52+
style={styles.textInput}
53+
value="<TextInput role='none' />"
54+
/>
55+
<TextInput
56+
accessible={false}
57+
style={styles.textInput}
58+
value="<TextInput accessible={false} />"
59+
/>
60+
</ScrollView>
61+
);
62+
}
63+
64+
const styles = StyleSheet.create({
65+
container: {
66+
flex: 1,
67+
},
68+
view: {
69+
padding: 20,
70+
backgroundColor: 'grey',
71+
},
72+
text: {
73+
padding: 20,
74+
backgroundColor: '#b1f2ff',
75+
},
76+
textInput: {
77+
padding: 20,
78+
backgroundColor: '#fbebd8',
79+
},
80+
});

0 commit comments

Comments
 (0)