From 700d320a5f1615a2ae6ea69bcc68b645a2cd4618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kruk?= Date: Wed, 10 Dec 2025 08:32:21 -0800 Subject: [PATCH] fix hit test for components using legacy module interop (#54802) Summary: This fixes hit tests in view using legacy module interop since the interop adds another view surrounding the actual view it needs to delegate the hit test to the actual component it wraps ## Changelog: [IOS] [FIXED] - Fix legacy module interop not handling hitTest correctly Pull Request resolved: https://github.com/facebook/react-native/pull/54802 Reviewed By: cortinico Differential Revision: D88630976 Pulled By: cipolleschi fbshipit-source-id: 85ce2b4e4244b05c19942208fdfb6a65d91e2f38 --- .../RCTLegacyViewManagerInteropComponentView.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/react-native/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm b/packages/react-native/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm index bec2ac59183..226781f27bf 100644 --- a/packages/react-native/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +++ b/packages/react-native/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm @@ -287,4 +287,15 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index"; [_adapter handleCommand:(NSString *)commandName args:(NSArray *)args]; } +- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event +{ + UIView *result = [super hitTest:point withEvent:event]; + + if (result == self) { + return nil; + } + + return result; +} + @end