@@ -44,6 +44,15 @@ export default class Badge extends PureBaseComponent {
44
44
* the badge size (default, small)
45
45
*/
46
46
size : PropTypes . oneOfType ( [ PropTypes . oneOf ( Object . keys ( BADGE_SIZES ) ) , PropTypes . number ] ) ,
47
+ /**
48
+ * Defines how far a touch event can start away from the badge.
49
+ */
50
+ hitSlop : PropTypes . shape ( {
51
+ top : PropTypes . number ,
52
+ bottom : PropTypes . number ,
53
+ left : PropTypes . number ,
54
+ right : PropTypes . number
55
+ } ) ,
47
56
/**
48
57
* width of border around the badge
49
58
*/
@@ -212,6 +221,7 @@ export default class Badge extends PureBaseComponent {
212
221
borderWidth,
213
222
backgroundColor,
214
223
containerStyle,
224
+ hitSlop,
215
225
icon,
216
226
onPress,
217
227
testId,
@@ -226,7 +236,7 @@ export default class Badge extends PureBaseComponent {
226
236
const Container = ! _ . isEmpty ( animationProps ) ? AnimatableView : onPress ? TouchableOpacity : View ;
227
237
if ( ! _ . isEmpty ( animationProps ) ) {
228
238
console . warn ( 'Badge component will soon stop supporting animationProps.' +
229
- 'Please wrap your Badge component with your own animation component, such as Animatable.View' , ) ;
239
+ 'Please wrap your Badge component with your own animation component, such as Animatable.View' ) ;
230
240
}
231
241
return (
232
242
// The extra View wrapper is to break badge's flex-ness
@@ -237,6 +247,7 @@ export default class Badge extends PureBaseComponent {
237
247
style = { [ sizeStyle , this . styles . badge , borderStyle , backgroundStyle ] }
238
248
onPress = { onPress }
239
249
activeOpacity = { activeOpacity }
250
+ hitSlop = { hitSlop }
240
251
{ ...animationProps }
241
252
>
242
253
{ icon ? this . renderIcon ( ) : this . renderLabel ( ) }
0 commit comments