Skip to content

Commit 0bd652f

Browse files
sbuggayfacebook-github-bot
authored andcommitted
Remove Surface Handlers for AppleTV (facebook#55196)
Summary: SurfaceTouch and SurfacePointer handlers use a lot of unsupported UIKit APIs. Instead of granuarly wrapping the UIKit usage, this minimally removes the handlers from AppleTV all-together, as they no-op anyways (there is no click-through support on simulator.) Changelog: [Internal] Reviewed By: Abbondanzo Differential Revision: D90704270
1 parent ef9bab2 commit 0bd652f

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

packages/react-native/React/Fabric/Mounting/ComponentViews/InputAccessory/RCTInputAccessoryComponentView.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@
4343
@implementation RCTInputAccessoryComponentView {
4444
InputAccessoryShadowNode::ConcreteState::Shared _state;
4545
RCTInputAccessoryContentView *_contentView;
46+
#if !TARGET_OS_TV
4647
RCTSurfaceTouchHandler *_touchHandler;
48+
#endif
4749
UIView<RCTBackedTextInputViewProtocol> __weak *_textInput;
4850
}
4951

@@ -52,8 +54,10 @@ - (instancetype)initWithFrame:(CGRect)frame
5254
if (self = [super initWithFrame:frame]) {
5355
_props = InputAccessoryShadowNode::defaultSharedProps();
5456
_contentView = [RCTInputAccessoryContentView new];
57+
#if !TARGET_OS_TV
5558
_touchHandler = [RCTSurfaceTouchHandler new];
5659
[_touchHandler attachToView:_contentView];
60+
#endif
5761
}
5862

5963
return self;

packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,19 @@
1212

1313
@implementation RCTFabricModalHostViewController {
1414
CGRect _lastViewBounds;
15+
#if !TARGET_OS_TV
1516
RCTSurfaceTouchHandler *_touchHandler;
17+
#endif
1618
}
1719

1820
- (instancetype)init
1921
{
2022
if ((self = [super init]) == nullptr) {
2123
return nil;
2224
}
25+
#if !TARGET_OS_TV
2326
_touchHandler = [RCTSurfaceTouchHandler new];
27+
#endif
2428

2529
return self;
2630
}
@@ -37,7 +41,9 @@ - (void)viewDidLayoutSubviews
3741
- (void)loadView
3842
{
3943
self.view = [UIView new];
44+
#if !TARGET_OS_TV
4045
[_touchHandler attachToView:self.view];
46+
#endif
4147
}
4248

4349
- (UIStatusBarStyle)preferredStatusBarStyle

packages/react-native/React/Fabric/RCTSurfacePointerHandler.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#import "RCTConversions.h"
1616
#import "RCTTouchableComponentViewProtocol.h"
1717

18+
#if !TARGET_OS_TV
19+
1820
using namespace facebook::react;
1921

2022
typedef NS_ENUM(NSInteger, RCTPointerEventType) {
@@ -771,3 +773,5 @@ - (void)hovering:(UIHoverGestureRecognizer *)recognizer
771773
}
772774

773775
@end
776+
777+
#endif // !TARGET_OS_TV

packages/react-native/React/Fabric/RCTSurfaceTouchHandler.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
#import "RCTSurfacePointerHandler.h"
1616
#import "RCTTouchableComponentViewProtocol.h"
1717

18+
#if !TARGET_OS_TV
19+
1820
using namespace facebook::react;
1921

2022
typedef NS_ENUM(NSInteger, RCTTouchEventType) {
@@ -414,3 +416,5 @@ - (void)_cancelTouches
414416
}
415417

416418
@end
419+
420+
#endif // !TARGET_OS_TV

packages/react-native/React/Fabric/Surface/RCTFabricSurface.mm

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,9 @@ @implementation RCTFabricSurface {
4545

4646
// Can be accessed from the main thread only.
4747
RCTSurfaceView *_Nullable _view;
48+
#if !TARGET_OS_TV
4849
RCTSurfaceTouchHandler *_Nullable _touchHandler;
50+
#endif
4951
}
5052

5153
@synthesize delegate = _delegate;
@@ -144,8 +146,10 @@ - (RCTSurfaceView *)view
144146
if (!_view) {
145147
_view = [[RCTSurfaceView alloc] initWithSurface:self];
146148
[self _updateLayoutContext];
149+
#if !TARGET_OS_TV
147150
_touchHandler = [RCTSurfaceTouchHandler new];
148151
[_touchHandler attachToView:_view];
152+
#endif
149153
}
150154

151155
return _view;

0 commit comments

Comments
 (0)