@@ -23,59 +23,64 @@ import {RadioGroupContextProps} from './RadioGroupContext';
23
23
const DEFAULT_SIZE = 24 ;
24
24
const DEFAULT_COLOR = Colors . blue30 ;
25
25
26
- export type RadioButtonProps = RadioGroupContextProps & ViewProps & {
27
- /**
28
- * The identifier value of the radio button. must be different than other RadioButtons in the same group
29
- */
30
- value ?: string | number | boolean ;
31
- /**
32
- * When using RadioButton without a RadioGroup, use this prop to toggle selection
33
- */
34
- selected ?: boolean ;
35
- /**
36
- * Invoked when pressing the button
37
- */
38
- onPress ?: ( selected : boolean ) => void ;
39
- /**
40
- * Whether the radio button should be disabled
41
- */
42
- disabled ?: boolean ;
43
- /**
44
- * The color of the radio button
45
- */
46
- color ?: string ;
47
- /**
48
- * The size of the radio button, affect both width & height
49
- */
50
- size ?: number ;
51
- /**
52
- * The radio button border radius
53
- */
54
- borderRadius ?: number ;
55
- /**
56
- * A label for the radio button description
57
- */
58
- label ?: string ;
59
- /**
60
- * Label style
61
- */
62
- labelStyle ?: TextStyle ;
63
- /**
64
- * Icon image source
65
- */
66
- iconSource ?: ImageSourcePropType ;
67
- /**
68
- * Icon image style
69
- */
70
- iconStyle ?: ImageStyle ;
71
- /**
72
- * Should the icon be on the right side of the label
73
- */
74
- iconOnRight ?: boolean ;
75
- /**
26
+ export type RadioButtonProps = RadioGroupContextProps &
27
+ ViewProps & {
28
+ /**
29
+ * The identifier value of the radio button. must be different than other RadioButtons in the same group
30
+ */
31
+ value ?: string | number | boolean ;
32
+ /**
33
+ * When using RadioButton without a RadioGroup, use this prop to toggle selection
34
+ */
35
+ selected ?: boolean ;
36
+ /**
37
+ * Invoked when pressing the button
38
+ */
39
+ onPress ?: ( selected : boolean ) => void ;
40
+ /**
41
+ * Whether the radio button should be disabled
42
+ */
43
+ disabled ?: boolean ;
44
+ /**
45
+ * The color of the radio button
46
+ */
47
+ color ?: string ;
48
+ /**
49
+ * The size of the radio button, affect both width & height
50
+ */
51
+ size ?: number ;
52
+ /**
53
+ * The radio button border radius
54
+ */
55
+ borderRadius ?: number ;
56
+ /**
57
+ * A label for the radio button description
58
+ */
59
+ label ?: string ;
60
+ /**
61
+ * Label style
62
+ */
63
+ labelStyle ?: TextStyle ;
64
+ /**
65
+ * Icon image source
66
+ */
67
+ iconSource ?: ImageSourcePropType ;
68
+ /**
69
+ * Icon image style
70
+ */
71
+ iconStyle ?: ImageStyle ;
72
+ /**
73
+ * Should the icon be on the right side of the label
74
+ */
75
+ iconOnRight ?: boolean ;
76
+ /**
76
77
* Should the content be rendered right to the button
77
78
*/
78
79
contentOnRight ?: boolean ;
80
+ /**
81
+ * Additional styling for the container
82
+ */
83
+ containerStyle ?: StyleProp < ViewStyle > ;
79
84
} ;
80
85
export type RadioButtonPropTypes = RadioButtonProps ; //TODO: remove after ComponentPropTypes deprecation;
81
86
@@ -224,7 +229,7 @@ class RadioButton extends PureComponent<Props, RadioButtonState> {
224
229
renderIcon ( ) {
225
230
const { iconSource, iconStyle} = this . props ;
226
231
const style = [ this . styles . image , iconStyle ] ;
227
- return iconSource && < Image style = { style } source = { iconSource } /> ;
232
+ return iconSource && < Image style = { style } source = { iconSource } /> ;
228
233
}
229
234
230
235
renderButton ( ) {
@@ -244,7 +249,7 @@ class RadioButton extends PureComponent<Props, RadioButtonState> {
244
249
}
245
250
246
251
render ( ) {
247
- const { onPress, onValueChange, contentOnRight, ...others } = this . props ;
252
+ const { onPress, onValueChange, contentOnRight, style , containerStyle , ...others } = this . props ;
248
253
const Container = onPress || onValueChange ? TouchableOpacity : View ;
249
254
250
255
return (
@@ -253,6 +258,7 @@ class RadioButton extends PureComponent<Props, RadioButtonState> {
253
258
row
254
259
centerV
255
260
activeOpacity = { 1 }
261
+ style = { containerStyle }
256
262
{ ...others }
257
263
onPress = { this . onPress }
258
264
{ ...this . getAccessibilityProps ( ) }
0 commit comments