Badge
Round colored badge, typically used to show a number
(code example)
This component extends TouchableOpacity, View props.
Usageβ
<Badge label={'999'} size={16}/>
APIβ
backgroundColorβ
Background color
string
borderColorβ
Color of border around the badge
ImageStyle['borderColor']
borderRadiusβ
Radius of border around the badge
number
borderWidthβ
Width of border around the badge
number
containerStyleβ
Additional styles for the top container
ViewStyle
customElementβ
Custom element to render instead of an icon
JSX.Element
hitSlopβ
Defines how far a touch event can start away from the badge
ViewProps['hitSlop']
iconβ
Renders an icon badge
ImageSourcePropType
iconPropsβ
Additional props passed to icon
ImageProps
iconStyleβ
Additional styling to badge icon
ImageStyle
labelβ
Passing a label (undefined) will present a pimple badgeβ
Text to show inside the badge
string
labelFormatterLimitβ
Beyond the max number for that digit length, a '+' will show at the end.β
If set to a value not included in LABEL_FORMATTER_VALUES, no formatting will occur.
Example: labelLengthFormatter=2, label=124, label will present '99+'
Receives a number from 1 to 4, representing the label's max digit length
LabelFormatterValues
labelStyleβ
Additional styles for the badge label
TextStyle
onPressβ
Called when the badge is pressed
(props: any) => void
sizeβ
Badge's size
number