Skip to content

Commit fa2a561

Browse files
authored
[tvOS] Fix build error (#4228)
## Description This PR fixes build on `tvOS` by omitting check for `UISwitch` Fixes #4223 ## Test plan Add Gesture Handler to tvOS app and check build
1 parent 45e6ac8 commit fa2a561

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

packages/react-native-gesture-handler/apple/Handlers/RNNativeViewHandler.mm

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,13 @@ - (void)bindToView:(UIView *)view
145145
// Pressing UISwitch triggers only touchUp and valueChanged callbacks. In order to align its behavior
146146
// with other UIControls, we have to dispatch full Gesture Handler events flow in one callback, as
147147
// touchesDown is not executed.
148+
#if !TARGET_OS_TV
148149
if ([view isKindOfClass:[UISwitch class]]) {
149150
_pointerType = RNGestureHandlerTouch;
150151
[control addTarget:self action:@selector(handleSwitch:) forControlEvents:UIControlEventValueChanged];
151-
} else {
152+
} else
153+
#endif // !TARGET_OS_TV
154+
{
152155
[control addTarget:self action:@selector(handleTouchDown:forEvent:) forControlEvents:UIControlEventTouchDown];
153156
[control addTarget:self
154157
action:@selector(handleTouchUpOutside:forEvent:)

0 commit comments

Comments
 (0)