From cf2da0ace072d75766ff8b940a890acb0c6ac302 Mon Sep 17 00:00:00 2001 From: Muhammad Suleman <53903082+MuhammadSuleman97@users.noreply.github.com> Date: Sat, 6 Jun 2026 23:52:18 +1000 Subject: [PATCH] fix: iOS hitTest should not check fill area when fill is none MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a Path has fill='none' and only a stroke, the hitTest on iOS was still checking _hitArea (the fill path) alongside strokePath. This caused inconsistent onPress behavior — touches on the stroke were sometimes missed because the fill-area check interfered. Now hitTest only considers fill area when self.fill is non-nil, only considers stroke area when self.stroke is non-nil and strokePath exists, and only considers marker area when markerPath exists. Fixes #1256 --- apple/RNSVGRenderable.mm | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/apple/RNSVGRenderable.mm b/apple/RNSVGRenderable.mm index 7aaf63a72..176f8f4ef 100644 --- a/apple/RNSVGRenderable.mm +++ b/apple/RNSVGRenderable.mm @@ -695,9 +695,12 @@ - (RNSVGPlatformView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event } BOOL evenodd = self.fillRule == kRNSVGCGFCRuleEvenodd; - if (!CGPathContainsPoint(_hitArea, nil, transformed, evenodd) && - !CGPathContainsPoint(self.strokePath, nil, transformed, NO) && - !CGPathContainsPoint(self.markerPath, nil, transformed, NO)) { + BOOL inFillArea = self.fill != nil && _hitArea && CGPathContainsPoint(_hitArea, nil, transformed, evenodd); + BOOL inStrokeArea = + self.stroke != nil && self.strokePath && CGPathContainsPoint(self.strokePath, nil, transformed, NO); + BOOL inMarkerArea = self.markerPath && CGPathContainsPoint(self.markerPath, nil, transformed, NO); + + if (!inFillArea && !inStrokeArea && !inMarkerArea) { return nil; } @@ -781,4 +784,4 @@ - (CGColor *)getCurrentColor return nil; } -@end +@end \ No newline at end of file