Skip to content

Commit f86b897

Browse files
authored
remove contentOnRight prop (#2473)
1 parent ed37af1 commit f86b897

File tree

2 files changed

+13
-21
lines changed

2 files changed

+13
-21
lines changed

src/components/radioButton/index.tsx

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,6 @@ export type RadioButtonProps = RadioGroupContextProps &
7272
* Should the icon be on the right side of the label
7373
*/
7474
iconOnRight?: boolean;
75-
/**
76-
* @deprecated The content is on right by default, for content on left use 'contentOnLeft'
77-
*/
78-
contentOnRight?: boolean;
7975
/**
8076
* Should the content be rendered left to the button
8177
*/
@@ -131,17 +127,12 @@ class RadioButton extends PureComponent<Props, RadioButtonState> {
131127
}
132128
}
133129

134-
get isContentOnLeft() {
135-
const {contentOnLeft, contentOnRight} = this.props;
136-
return contentOnLeft || contentOnRight;
137-
}
138-
139130
animate() {
140131
const {selected} = this.props;
141132
const {opacityAnimationValue, scaleAnimationValue} = this.state;
142133
const animationTime = 150;
143134
const animationDelay = 60;
144-
135+
145136
if (selected) {
146137
Animated.parallel([
147138
Animated.timing(opacityAnimationValue, {
@@ -227,10 +218,17 @@ class RadioButton extends PureComponent<Props, RadioButtonState> {
227218
}
228219

229220
renderLabel() {
230-
const {label, labelStyle, testID} = this.props;
221+
const {label, labelStyle, contentOnLeft, testID} = this.props;
231222
return (
232223
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+
>
234232
{label}
235233
</Text>
236234
)
@@ -260,7 +258,7 @@ class RadioButton extends PureComponent<Props, RadioButtonState> {
260258
}
261259

262260
render() {
263-
const {onPress, onValueChange, containerStyle, ...others} = this.props;
261+
const {onPress, onValueChange, containerStyle, contentOnLeft, ...others} = this.props;
264262
const Container = onPress || onValueChange ? TouchableOpacity : View;
265263

266264
return (
@@ -274,10 +272,10 @@ class RadioButton extends PureComponent<Props, RadioButtonState> {
274272
onPress={this.onPress}
275273
{...this.getAccessibilityProps()}
276274
>
277-
{!this.isContentOnLeft && this.renderButton()}
275+
{!contentOnLeft && this.renderButton()}
278276
{this.props.iconOnRight ? this.renderLabel() : this.renderIcon()}
279277
{this.props.iconOnRight ? this.renderIcon() : this.renderLabel()}
280-
{this.isContentOnLeft && this.renderButton()}
278+
{contentOnLeft && this.renderButton()}
281279
</Container>
282280
);
283281
}

src/components/radioButton/radioButton.api.json

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,6 @@
4040
"description": "Should the icon be on the right side of the label",
4141
"default": "false"
4242
},
43-
{
44-
"name": "contentOnRight",
45-
"type": "boolean",
46-
"description": "Deprecated. The content is on right by default, for content on left use 'contentOnLeft'",
47-
"deprecated": true
48-
},
4943
{"name": "contentOnLeft", "type": "boolean", "description": "Should the content be rendered left to the button"},
5044
{"name": "containerStyle", "type": "ViewStyle", "description": "Additional styling for the container"}
5145
],

0 commit comments

Comments
 (0)