mirror of
https://github.com/status-im/react-native.git
synced 2025-01-12 10:34:57 +00:00
Fabric: Custom [RCTViewComponentView hitTest:]
that takes pointerEvents
into an account
Summary: @public In RN we have special `pointerEvents` prop that controls whether the View can be the target of touch events. This is a pretty straight-forward implementation of that. Reviewed By: sahrens Differential Revision: D9688877 fbshipit-source-id: 1524647b0a33e4dd14563f531d636469bf3bdef7
This commit is contained in:
parent
1e3e2387d3
commit
dbf5bea3c1
@ -196,6 +196,22 @@ using namespace facebook::react;
|
||||
[self invalidateLayer];
|
||||
}
|
||||
|
||||
- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event
|
||||
{
|
||||
auto viewProps = *std::static_pointer_cast<const ViewProps>(_props);
|
||||
switch (viewProps.pointerEvents) {
|
||||
case PointerEventsMode::Auto:
|
||||
return [super hitTest:point withEvent:event];
|
||||
case PointerEventsMode::None:
|
||||
return nil;
|
||||
case PointerEventsMode::BoxOnly:
|
||||
return [self pointInside:point withEvent:event] ? self : nil;
|
||||
case PointerEventsMode::BoxNone:
|
||||
UIView *view = [super hitTest:point withEvent:event];
|
||||
return view != self ? view : nil;
|
||||
}
|
||||
}
|
||||
|
||||
static RCTCornerRadii RCTCornerRadiiFromBorderRadii(BorderRadii borderRadii) {
|
||||
return RCTCornerRadii {
|
||||
.topLeft = (CGFloat)borderRadii.topLeft,
|
||||
|
Loading…
x
Reference in New Issue
Block a user