From c907202d2b5986744d69efeb7c5e4f40ed6df631 Mon Sep 17 00:00:00 2001 From: Samuel Susla Date: Thu, 24 Sep 2020 01:01:03 -0700 Subject: [PATCH] Fix touch handling in bridged paper components Summary: Changelog: [internal] If view was bridged from Paper, hit testing would return Paper view which doesn't have reference to Fabric's event emitter. To fix this, if the bridged view is returned from hit testing, it is swapped with interop view which has reference to event emitter. Reviewed By: shergin Differential Revision: D23840054 fbshipit-source-id: d4aa4ee8da4e1da80d2e2b69b79ed82d726f04e3 --- .../RCTLegacyViewManagerInteropComponentView.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm index 8c9a97ce6aa..3262418b178 100644 --- a/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm +++ b/React/Fabric/Mounting/ComponentViews/LegacyViewManagerInterop/RCTLegacyViewManagerInteropComponentView.mm @@ -37,6 +37,17 @@ static NSString *const kRCTLegacyInteropChildIndexKey = @"index"; return self; } +- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event +{ + UIView *result = [super hitTest:point withEvent:event]; + + if (result == _adapter.paperView) { + return self; + } + + return result; +} + + (NSMutableSet *)supportedViewManagers { static NSMutableSet *supported = [NSMutableSet setWithObjects:@"Picker",