feat: introduce hitSlop prop (#2407)

# Summary

Explain the **motivation** for making this change: here are some points
to help you:

* What issues does the pull request solve? Please tag them so that they
will get automatically closed once the PR is merged
* What is the feature? (if applicable)
* How did you implement the solution?
* What areas of the library does it impact?

## Test Plan

Demonstrate the code is solid. Example: The exact commands you ran and
their output, screenshots / videos if the pull request changes UI.

### What's required for testing (prerequisites)?

### What are the steps to reproduce (after prerequisites)?

## Compatibility

| OS      | Implemented |
| ------- | :---------: |
| iOS     |         |
| MacOS   |          |
| Android |          |
| Web     |          |
This commit is contained in:
Jakub Grzywacz
2024-08-19 09:11:07 +02:00
committed by GitHub
parent 7cf90f2f10
commit ca1c35caa9
13 changed files with 113 additions and 23 deletions
+15
View File
@@ -28,5 +28,20 @@ RCT_EXPORT_VIEW_PROPERTY(align, NSString)
RCT_EXPORT_VIEW_PROPERTY(meetOrSlice, RNSVGVBMOS)
RCT_EXPORT_VIEW_PROPERTY(tintColor, UIColor)
RCT_REMAP_VIEW_PROPERTY(color, tintColor, UIColor)
RCT_CUSTOM_VIEW_PROPERTY(hitSlop, UIEdgeInsets, RNSVGSvgView)
{
if ([view respondsToSelector:@selector(setHitTestEdgeInsets:)]) {
if (json) {
UIEdgeInsets hitSlopInsets = [RCTConvert UIEdgeInsets:json];
[view setHitTestEdgeInsets:UIEdgeInsetsMake(
-hitSlopInsets.top,
-hitSlopInsets.left,
-hitSlopInsets.bottom,
-hitSlopInsets.right)];
} else {
view.hitTestEdgeInsets = defaultView.hitTestEdgeInsets;
}
}
}
@end