Skip to content

Commit ae49223

Browse files
authored
Checkbox + RadioButton - fix long labels are stretching outside (#2446)
* Checkbox + RadioButton - fix long labels are stretching outside their container * use flex shrink instead of margins
1 parent 4b10c45 commit ae49223

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/components/checkbox/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,9 @@ class Checkbox extends Component<CheckboxProps, CheckboxState> {
240240
render() {
241241
const {label, labelStyle, containerStyle, labelProps} = this.props;
242242
return label ? (
243-
<View row centerV style={[containerStyle]}>
243+
<View row centerV style={containerStyle}>
244244
{this.renderCheckbox()}
245-
<Text style={[this.styles.checkboxLabel, labelStyle]} {...labelProps} onPress={this.onPress}>
245+
<Text flexS style={[this.styles.checkboxLabel, labelStyle]} {...labelProps} onPress={this.onPress}>
246246
{label}
247247
</Text>
248248
</View>

src/components/radioButton/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ class RadioButton extends PureComponent<Props, RadioButtonState> {
141141
const {opacityAnimationValue, scaleAnimationValue} = this.state;
142142
const animationTime = 150;
143143
const animationDelay = 60;
144+
144145
if (selected) {
145146
Animated.parallel([
146147
Animated.timing(opacityAnimationValue, {
@@ -229,7 +230,7 @@ class RadioButton extends PureComponent<Props, RadioButtonState> {
229230
const {label, labelStyle, testID} = this.props;
230231
return (
231232
label && (
232-
<Text marginL-10={!this.isContentOnLeft} marginR-10={this.isContentOnLeft} $textDefault style={labelStyle} testID={`${testID}.label`}>
233+
<Text flexS marginL-10={!this.isContentOnLeft} marginR-10={this.isContentOnLeft} $textDefault style={labelStyle} testID={`${testID}.label`}>
233234
{label}
234235
</Text>
235236
)

0 commit comments

Comments
 (0)