@@ -72,10 +72,6 @@ export type RadioButtonProps = RadioGroupContextProps &
72
72
* Should the icon be on the right side of the label
73
73
*/
74
74
iconOnRight ?: boolean ;
75
- /**
76
- * @deprecated The content is on right by default, for content on left use 'contentOnLeft'
77
- */
78
- contentOnRight ?: boolean ;
79
75
/**
80
76
* Should the content be rendered left to the button
81
77
*/
@@ -131,17 +127,12 @@ class RadioButton extends PureComponent<Props, RadioButtonState> {
131
127
}
132
128
}
133
129
134
- get isContentOnLeft ( ) {
135
- const { contentOnLeft, contentOnRight} = this . props ;
136
- return contentOnLeft || contentOnRight ;
137
- }
138
-
139
130
animate ( ) {
140
131
const { selected} = this . props ;
141
132
const { opacityAnimationValue, scaleAnimationValue} = this . state ;
142
133
const animationTime = 150 ;
143
134
const animationDelay = 60 ;
144
-
135
+
145
136
if ( selected ) {
146
137
Animated . parallel ( [
147
138
Animated . timing ( opacityAnimationValue , {
@@ -227,10 +218,17 @@ class RadioButton extends PureComponent<Props, RadioButtonState> {
227
218
}
228
219
229
220
renderLabel ( ) {
230
- const { label, labelStyle, testID} = this . props ;
221
+ const { label, labelStyle, contentOnLeft , testID} = this . props ;
231
222
return (
232
223
label && (
233
- < Text flexS marginL-10 = { ! this . isContentOnLeft } marginR-10 = { this . isContentOnLeft } $textDefault style = { labelStyle } testID = { `${ testID } .label` } >
224
+ < Text
225
+ flexS
226
+ marginL-10 = { ! contentOnLeft }
227
+ marginR-10 = { contentOnLeft }
228
+ $textDefault
229
+ style = { labelStyle }
230
+ testID = { `${ testID } .label` }
231
+ >
234
232
{ label }
235
233
</ Text >
236
234
)
@@ -260,7 +258,7 @@ class RadioButton extends PureComponent<Props, RadioButtonState> {
260
258
}
261
259
262
260
render ( ) {
263
- const { onPress, onValueChange, containerStyle, ...others } = this . props ;
261
+ const { onPress, onValueChange, containerStyle, contentOnLeft , ...others } = this . props ;
264
262
const Container = onPress || onValueChange ? TouchableOpacity : View ;
265
263
266
264
return (
@@ -274,10 +272,10 @@ class RadioButton extends PureComponent<Props, RadioButtonState> {
274
272
onPress = { this . onPress }
275
273
{ ...this . getAccessibilityProps ( ) }
276
274
>
277
- { ! this . isContentOnLeft && this . renderButton ( ) }
275
+ { ! contentOnLeft && this . renderButton ( ) }
278
276
{ this . props . iconOnRight ? this . renderLabel ( ) : this . renderIcon ( ) }
279
277
{ this . props . iconOnRight ? this . renderIcon ( ) : this . renderLabel ( ) }
280
- { this . isContentOnLeft && this . renderButton ( ) }
278
+ { contentOnLeft && this . renderButton ( ) }
281
279
</ Container >
282
280
) ;
283
281
}
0 commit comments