Skip to content

Commit cb33bc9

Browse files
osdnkkmagiera
authored andcommitted
Fix compatibility with TV (software-mansion#475)
This is a fix for software-mansion#448. `ifndef TARGET_OS_TV` is not proper check since `TARGET_OS_TV` is defined, but set to `NO` https://github.com/kmagiera/react-native-gesture-handler/pull/475/files#diff-18049faae8f7be012debf7181b7ee576L24 Also, it seems to unwanted change. This code is no compilable.
1 parent c9f7c46 commit cb33bc9

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

Diff for: ios/Handlers/RNFlingHandler.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ - (void)configure:(NSDictionary *)config
2121
recognizer.direction = [RCTConvert NSInteger:prop];
2222
}
2323

24-
#ifndef TARGET_OS_TV
24+
#if !TARGET_OS_TV
2525
prop = config[@"numberOfPointers"];
2626
if (prop != nil) {
2727
recognizer.numberOfTouchesRequired = [RCTConvert NSInteger:prop];

Diff for: ios/Handlers/RNForceTouchHandler.m

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ - (BOOL)shouldFail {
7676

7777
- (void)performFeedbackIfRequired
7878
{
79-
#ifndef TARGET_OS_TV
79+
#if !TARGET_OS_TV
8080
if (_feedbackOnActivation) {
8181
if (@available(iOS 10.0, *)) {
8282
[[[UIImpactFeedbackGenerator alloc] initWithStyle:(UIImpactFeedbackStyleMedium)] impactOccurred];

Diff for: ios/Handlers/RNPanHandler.m

+4-4
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ - (id)initWithGestureHandler:(RNGestureHandler*)gestureHandler
5454
_failOffsetYStart = NAN;
5555
_failOffsetYEnd = NAN;
5656
_hasCustomActivationCriteria = NO;
57-
#ifndef TARGET_OS_TV
57+
#if !TARGET_OS_TV
5858
_realMinimumNumberOfTouches = self.minimumNumberOfTouches;
5959
#endif
6060
}
@@ -68,7 +68,7 @@ - (void)setMinimumNumberOfTouches:(NSUInteger)minimumNumberOfTouches
6868

6969
- (void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
7070
{
71-
#ifndef TARGET_OS_TV
71+
#if !TARGET_OS_TV
7272
if (_hasCustomActivationCriteria) {
7373
// We use "minimumNumberOfTouches" property to prevent pan handler from recognizing
7474
// the gesture too early before we are sure that all criteria (e.g. minimum distance
@@ -102,7 +102,7 @@ - (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
102102
}
103103
}
104104
if (_hasCustomActivationCriteria && self.state == UIGestureRecognizerStatePossible && [self shouldActivateUnderCustomCriteria]) {
105-
#ifndef TARGET_OS_TV
105+
#if !TARGET_OS_TV
106106
super.minimumNumberOfTouches = _realMinimumNumberOfTouches;
107107
if ([self numberOfTouches] >= _realMinimumNumberOfTouches) {
108108
self.state = UIGestureRecognizerStateBegan;
@@ -206,7 +206,7 @@ - (void)configure:(NSDictionary *)config
206206
APPLY_FLOAT_PROP(failOffsetYStart);
207207
APPLY_FLOAT_PROP(failOffsetYEnd);
208208

209-
#ifndef TARGET_OS_TV
209+
#if !TARGET_OS_TV
210210
APPLY_NAMED_INT_PROP(minimumNumberOfTouches, @"minPointers");
211211
APPLY_NAMED_INT_PROP(maximumNumberOfTouches, @"maxPointers");
212212
#endif

Diff for: ios/Handlers/RNPinchHandler.m

+2-2
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,14 @@ @implementation RNPinchGestureHandler
1313
- (instancetype)initWithTag:(NSNumber *)tag
1414
{
1515
if ((self = [super initWithTag:tag])) {
16-
#ifndef TARGET_OS_TV
16+
#if !TARGET_OS_TV
1717
_recognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)];
1818
#endif
1919
}
2020
return self;
2121
}
2222

23-
#ifndef TARGET_OS_TV
23+
#if !TARGET_OS_TV
2424
- (RNGestureHandlerEventExtraData *)eventExtraData:(UIPinchGestureRecognizer *)recognizer
2525
{
2626
return [RNGestureHandlerEventExtraData

Diff for: ios/Handlers/RNRotationHandler.m

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,14 @@ @implementation RNRotationGestureHandler
1313
- (instancetype)initWithTag:(NSNumber *)tag
1414
{
1515
if ((self = [super initWithTag:tag])) {
16-
#ifndef TARGET_OS_TV
16+
#if !TARGET_OS_TV
1717
_recognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)];
1818
#endif
1919
}
2020
return self;
2121
}
2222

23-
#ifndef TARGET_OS_TV
24-
_recognizer = [[UIRotation
23+
#if !TARGET_OS_TV
2524
- (RNGestureHandlerEventExtraData *)eventExtraData:(UIRotationGestureRecognizer *)recognizer
2625
{
2726
return [RNGestureHandlerEventExtraData

0 commit comments

Comments
 (0)