From ca9ca1b044707092159641a824a30c8b0b4c9262 Mon Sep 17 00:00:00 2001 From: Lidor Dafna Date: Wed, 15 Feb 2023 12:28:34 +0200 Subject: [PATCH] remove contentOnRight prop --- src/components/radioButton/index.tsx | 28 +++++++++---------- .../radioButton/radioButton.api.json | 6 ---- 2 files changed, 13 insertions(+), 21 deletions(-) diff --git a/src/components/radioButton/index.tsx b/src/components/radioButton/index.tsx index a224af1222..252e536443 100644 --- a/src/components/radioButton/index.tsx +++ b/src/components/radioButton/index.tsx @@ -72,10 +72,6 @@ export type RadioButtonProps = RadioGroupContextProps & * Should the icon be on the right side of the label */ iconOnRight?: boolean; - /** - * @deprecated The content is on right by default, for content on left use 'contentOnLeft' - */ - contentOnRight?: boolean; /** * Should the content be rendered left to the button */ @@ -131,17 +127,12 @@ class RadioButton extends PureComponent { } } - get isContentOnLeft() { - const {contentOnLeft, contentOnRight} = this.props; - return contentOnLeft || contentOnRight; - } - animate() { const {selected} = this.props; const {opacityAnimationValue, scaleAnimationValue} = this.state; const animationTime = 150; const animationDelay = 60; - + if (selected) { Animated.parallel([ Animated.timing(opacityAnimationValue, { @@ -227,10 +218,17 @@ class RadioButton extends PureComponent { } renderLabel() { - const {label, labelStyle, testID} = this.props; + const {label, labelStyle, contentOnLeft, testID} = this.props; return ( label && ( - + {label} ) @@ -260,7 +258,7 @@ class RadioButton extends PureComponent { } render() { - const {onPress, onValueChange, containerStyle, ...others} = this.props; + const {onPress, onValueChange, containerStyle, contentOnLeft, ...others} = this.props; const Container = onPress || onValueChange ? TouchableOpacity : View; return ( @@ -274,10 +272,10 @@ class RadioButton extends PureComponent { onPress={this.onPress} {...this.getAccessibilityProps()} > - {!this.isContentOnLeft && this.renderButton()} + {!contentOnLeft && this.renderButton()} {this.props.iconOnRight ? this.renderLabel() : this.renderIcon()} {this.props.iconOnRight ? this.renderIcon() : this.renderLabel()} - {this.isContentOnLeft && this.renderButton()} + {contentOnLeft && this.renderButton()} ); } diff --git a/src/components/radioButton/radioButton.api.json b/src/components/radioButton/radioButton.api.json index 42519552d0..8ff641d788 100644 --- a/src/components/radioButton/radioButton.api.json +++ b/src/components/radioButton/radioButton.api.json @@ -40,12 +40,6 @@ "description": "Should the icon be on the right side of the label", "default": "false" }, - { - "name": "contentOnRight", - "type": "boolean", - "description": "Deprecated. The content is on right by default, for content on left use 'contentOnLeft'", - "deprecated": true - }, {"name": "contentOnLeft", "type": "boolean", "description": "Should the content be rendered left to the button"}, {"name": "containerStyle", "type": "ViewStyle", "description": "Additional styling for the container"} ],