@@ -18,76 +18,9 @@ import TouchableOpacity from '../touchableOpacity';
18
18
import Image from '../image' ;
19
19
import View from '../view' ;
20
20
21
-
22
21
const DEFAULT_SIZE = 16 ;
23
22
const LABEL_FORMATTER_VALUES = [ 1 , 2 , 3 , 4 ] as const ;
24
- type LabelFormatterValues = typeof LABEL_FORMATTER_VALUES [ number ]
25
-
26
- export type BadgeProps = ViewProps & TouchableOpacityProps & {
27
- /**
28
- * Text to show inside the badge.
29
- * Not passing a label (undefined) will present a pimple badge.
30
- */
31
- label ?: string ;
32
- /**
33
- * Color of the badge background
34
- */
35
- backgroundColor ?: string ;
36
- /**
37
- * the badge size
38
- */
39
- size : number ;
40
- /**
41
- * Press handler
42
- */
43
- onPress ?: ( props : any ) => void ;
44
- /**
45
- * Defines how far a touch event can start away from the badge.
46
- */
47
- hitSlop ?: ViewProps [ 'hitSlop' ] ;
48
- /**
49
- * width of border around the badge
50
- */
51
- borderWidth ?: number ;
52
- /**
53
- * radius of border around the badge
54
- */
55
- borderRadius ?: number ;
56
- /**
57
- * color of border around the badge
58
- */
59
- borderColor ?: ImageStyle [ 'borderColor' ] ;
60
- /**
61
- * Additional styles for the top container
62
- */
63
- containerStyle ?: StyleProp < ViewStyle >
64
- /**
65
- * Additional styles for the badge label
66
- */
67
- labelStyle ?: TextStyle ;
68
- /**
69
- * Receives a number from 1 to 4, representing the label's max digit length.
70
- * Beyond the max number for that digit length, a "+" will show at the end.
71
- * If set to a value not included in LABEL_FORMATTER_VALUES, no formatting will occur.
72
- * Example: labelLengthFormatter={2}, label={124}, label will present "99+".
73
- */
74
- labelFormatterLimit ?: LabelFormatterValues ;
75
- /**
76
- * Renders an icon badge
77
- */
78
- icon ?: ImageSourcePropType ;
79
- /**
80
- * Additional styling to badge icon
81
- */
82
- iconStyle ?: object ;
83
- /**
84
- * Additional props passed to icon
85
- */
86
- iconProps ?: object ;
87
- }
88
-
89
23
type LabelFormatterValues = typeof LABEL_FORMATTER_VALUES [ number ] ;
90
- export type BadgeSizes = keyof typeof BADGE_SIZES ;
91
24
92
25
export type BadgeProps = ViewProps &
93
26
TouchableOpacityProps & {
@@ -103,7 +36,7 @@ export type BadgeProps = ViewProps &
103
36
/**
104
37
* the badge size (default, small)
105
38
*/
106
- size : BadgeSizes | number ;
39
+ size : number ;
107
40
/**
108
41
* Press handler
109
42
*/
@@ -136,7 +69,7 @@ export type BadgeProps = ViewProps &
136
69
* Receives a number from 1 to 4, representing the label's max digit length.
137
70
* Beyond the max number for that digit length, a "+" will show at the end.
138
71
* If set to a value not included in LABEL_FORMATTER_VALUES, no formatting will occur.
139
- * Example: labelLengthFormater ={2}, label={124}, label will present "99+".
72
+ * Example: labelLengthFormatter ={2}, label={124}, label will present "99+".
140
73
*/
141
74
labelFormatterLimit ?: LabelFormatterValues ;
142
75
/**
0 commit comments