File tree Expand file tree Collapse file tree 2 files changed +18
-15
lines changed Expand file tree Collapse file tree 2 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -314,17 +314,17 @@ export default class Avatar extends PureBaseComponent {
314
314
style = { [ this . getContainerStyle ( ) , containerStyle ] }
315
315
testID = { testID }
316
316
onPress = { onPress }
317
- accessible
317
+ accessible = { ! _ . isUndefined ( onPress ) }
318
318
accessibilityLabel = { 'Avatar' }
319
319
accessibilityRole = { onPress ? 'button' : 'image' }
320
320
{ ...this . extractAccessibilityProps ( ) }
321
321
>
322
322
< View
323
323
style = { [ this . getInitialsContainer ( ) , { backgroundColor} , hasImage && this . styles . initialsContainerWithInset ] }
324
324
>
325
- < Text numberOfLines = { 1 } style = { [ { fontSize} , this . styles . initials , { color} ] } >
325
+ { ! _ . isUndefined ( label ) && < Text numberOfLines = { 1 } style = { [ { fontSize} , this . styles . initials , { color} ] } >
326
326
{ label }
327
- </ Text >
327
+ </ Text > }
328
328
</ View >
329
329
{ this . renderImage ( ) }
330
330
{ this . renderBadge ( ) }
Original file line number Diff line number Diff line change @@ -103,7 +103,7 @@ export default class Badge extends PureBaseComponent {
103
103
return {
104
104
accessibilityLabel : icon ? 'badge' : label ? `${ label } new items` : undefined ,
105
105
...this . extractAccessibilityProps ( ) ,
106
- accessible : true ,
106
+ accessible : ! _ . isUndefined ( label ) ,
107
107
accessibilityRole : onPress ? 'button' : icon ? 'image' : 'text'
108
108
} ;
109
109
}
@@ -173,17 +173,20 @@ export default class Badge extends PureBaseComponent {
173
173
}
174
174
175
175
renderLabel ( ) {
176
- const { labelStyle} = this . props ;
177
- return (
178
- < Text
179
- style = { [ this . styles . label , this . isSmallBadge ( ) && this . styles . labelSmall , labelStyle ] }
180
- allowFontScaling = { false }
181
- numberOfLines = { 1 }
182
- testID = "badge"
183
- >
184
- { this . getFormattedLabel ( ) }
185
- </ Text >
186
- ) ;
176
+ const { labelStyle, label} = this . props ;
177
+
178
+ if ( label ) {
179
+ return (
180
+ < Text
181
+ style = { [ this . styles . label , this . isSmallBadge ( ) && this . styles . labelSmall , labelStyle ] }
182
+ allowFontScaling = { false }
183
+ numberOfLines = { 1 }
184
+ testID = "badge"
185
+ >
186
+ { this . getFormattedLabel ( ) }
187
+ </ Text >
188
+ ) ;
189
+ }
187
190
}
188
191
189
192
renderIcon ( ) {
You can’t perform that action at this time.
0 commit comments