@@ -21,51 +21,57 @@ const ViewPropTypes = RNViewPropTypes || View.propTypes;
21
21
let componentIndex = 0 ;
22
22
23
23
const propTypes = {
24
- data : PropTypes . array ,
25
- onChange : PropTypes . func ,
26
- initValue : PropTypes . string ,
27
- animationType : Modal . propTypes . animationType ,
28
- style : ViewPropTypes . style ,
29
- selectStyle : ViewPropTypes . style ,
30
- selectTextStyle : Text . propTypes . style ,
31
- optionStyle : ViewPropTypes . style ,
32
- optionTextStyle : Text . propTypes . style ,
33
- optionContainerStyle : ViewPropTypes . style ,
34
- sectionStyle : ViewPropTypes . style ,
35
- sectionTextStyle : Text . propTypes . style ,
36
- cancelContainerStyle : ViewPropTypes . style ,
37
- cancelStyle : ViewPropTypes . style ,
38
- cancelTextStyle : Text . propTypes . style ,
39
- overlayStyle : ViewPropTypes . style ,
40
- cancelText : PropTypes . string ,
41
- disabled : PropTypes . bool ,
42
- supportedOrientations : Modal . propTypes . supportedOrientations ,
43
- keyboardShouldPersistTaps : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . bool ] ) ,
44
- backdropPressToClose : PropTypes . bool ,
24
+ data : PropTypes . array ,
25
+ onChange : PropTypes . func ,
26
+ initValue : PropTypes . string ,
27
+ animationType : Modal . propTypes . animationType ,
28
+ style : ViewPropTypes . style ,
29
+ selectStyle : ViewPropTypes . style ,
30
+ selectTextStyle : Text . propTypes . style ,
31
+ optionStyle : ViewPropTypes . style ,
32
+ optionTextStyle : Text . propTypes . style ,
33
+ optionContainerStyle : ViewPropTypes . style ,
34
+ sectionStyle : ViewPropTypes . style ,
35
+ sectionTextStyle : Text . propTypes . style ,
36
+ cancelContainerStyle : ViewPropTypes . style ,
37
+ cancelStyle : ViewPropTypes . style ,
38
+ cancelTextStyle : Text . propTypes . style ,
39
+ overlayStyle : ViewPropTypes . style ,
40
+ cancelText : PropTypes . string ,
41
+ disabled : PropTypes . bool ,
42
+ supportedOrientations : Modal . propTypes . supportedOrientations ,
43
+ keyboardShouldPersistTaps : PropTypes . oneOfType ( [ PropTypes . string , PropTypes . bool ] ) ,
44
+ backdropPressToClose : PropTypes . bool ,
45
+ accessible : PropTypes . bool ,
46
+ scrollViewAccessibilityLabel : PropTypes . string ,
47
+ cancelButtonAccessibilityLabel : PropTypes . string ,
45
48
} ;
46
49
47
50
const defaultProps = {
48
- data : [ ] ,
49
- onChange : ( ) => { } ,
50
- initValue : 'Select me!' ,
51
- animationType : 'slide' ,
52
- style : { } ,
53
- selectStyle : { } ,
54
- selectTextStyle : { } ,
55
- optionStyle : { } ,
56
- optionTextStyle : { } ,
57
- optionContainerStyle : { } ,
58
- sectionStyle : { } ,
59
- sectionTextStyle : { } ,
60
- cancelContainerStyle : { } ,
61
- cancelStyle : { } ,
62
- cancelTextStyle : { } ,
63
- overlayStyle : { } ,
64
- cancelText : 'cancel' ,
65
- disabled : false ,
66
- supportedOrientations : [ 'portrait' , 'landscape' ] ,
67
- keyboardShouldPersistTaps : 'always' ,
68
- backdropPressToClose : false ,
51
+ data : [ ] ,
52
+ onChange : ( ) => { } ,
53
+ initValue : 'Select me!' ,
54
+ animationType : 'slide' ,
55
+ style : { } ,
56
+ selectStyle : { } ,
57
+ selectTextStyle : { } ,
58
+ optionStyle : { } ,
59
+ optionTextStyle : { } ,
60
+ optionContainerStyle : { } ,
61
+ sectionStyle : { } ,
62
+ sectionTextStyle : { } ,
63
+ cancelContainerStyle : { } ,
64
+ cancelStyle : { } ,
65
+ cancelTextStyle : { } ,
66
+ overlayStyle : { } ,
67
+ cancelText : 'cancel' ,
68
+ disabled : false ,
69
+ supportedOrientations : [ 'portrait' , 'landscape' ] ,
70
+ keyboardShouldPersistTaps : 'always' ,
71
+ backdropPressToClose : false ,
72
+ accessible : false ,
73
+ scrollViewAccessibilityLabel : undefined ,
74
+ cancelButtonAccessibilityLabel : undefined ,
69
75
} ;
70
76
71
77
export default class ModalSelector extends React . Component {
@@ -119,7 +125,7 @@ export default class ModalSelector extends React.Component {
119
125
120
126
renderOption = ( option , isLastItem ) => {
121
127
return (
122
- < TouchableOpacity key = { option . key } onPress = { ( ) => this . onChange ( option ) } >
128
+ < TouchableOpacity key = { option . key } onPress = { ( ) => this . onChange ( option ) } accessible = { this . props . accessible } accessibilityLabel = { option . accessibilityLabel || undefined } >
123
129
< View style = { [ styles . optionStyle , this . props . optionStyle , isLastItem &&
124
130
{ borderBottomWidth : 0 } ] } >
125
131
< Text style = { [ styles . optionTextStyle , this . props . optionTextStyle ] } > { option . label } </ Text >
@@ -144,14 +150,14 @@ export default class ModalSelector extends React.Component {
144
150
} } >
145
151
< View style = { [ styles . overlayStyle , this . props . overlayStyle ] } >
146
152
< View style = { [ styles . optionContainer , this . props . optionContainerStyle ] } >
147
- < ScrollView keyboardShouldPersistTaps = { this . props . keyboardShouldPersistTaps } >
153
+ < ScrollView keyboardShouldPersistTaps = { this . props . keyboardShouldPersistTaps } accessible = { this . props . accessible } accessibilityLabel = { this . props . scrollViewAccessibilityLabel } >
148
154
< View style = { { paddingHorizontal : 10 } } >
149
155
{ options }
150
156
</ View >
151
157
</ ScrollView >
152
158
</ View >
153
159
< View style = { [ styles . cancelContainer , this . props . cancelContainerStyle ] } >
154
- < TouchableOpacity onPress = { this . close } >
160
+ < TouchableOpacity onPress = { this . close } accessible = { this . props . accessible } accessibilityLabel = { this . props . cancelButtonAccessibilityLabel } >
155
161
< View style = { [ styles . cancelStyle , this . props . cancelStyle ] } >
156
162
< Text style = { [ styles . cancelTextStyle , this . props . cancelTextStyle ] } > { this . props . cancelText } </ Text >
157
163
</ View >
0 commit comments