Skip to content

Commit

Permalink
Fix compatibility with TV (software-mansion#475)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
osdnk authored and kmagiera committed Feb 28, 2019
1 parent c9f7c46 commit cb33bc9
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion ios/Handlers/RNFlingHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ - (void)configure:(NSDictionary *)config
recognizer.direction = [RCTConvert NSInteger:prop];
}

#ifndef TARGET_OS_TV
#if !TARGET_OS_TV
prop = config[@"numberOfPointers"];
if (prop != nil) {
recognizer.numberOfTouchesRequired = [RCTConvert NSInteger:prop];
Expand Down
2 changes: 1 addition & 1 deletion ios/Handlers/RNForceTouchHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ - (BOOL)shouldFail {

- (void)performFeedbackIfRequired
{
#ifndef TARGET_OS_TV
#if !TARGET_OS_TV
if (_feedbackOnActivation) {
if (@available(iOS 10.0, *)) {
[[[UIImpactFeedbackGenerator alloc] initWithStyle:(UIImpactFeedbackStyleMedium)] impactOccurred];
Expand Down
8 changes: 4 additions & 4 deletions ios/Handlers/RNPanHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ - (id)initWithGestureHandler:(RNGestureHandler*)gestureHandler
_failOffsetYStart = NAN;
_failOffsetYEnd = NAN;
_hasCustomActivationCriteria = NO;
#ifndef TARGET_OS_TV
#if !TARGET_OS_TV
_realMinimumNumberOfTouches = self.minimumNumberOfTouches;
#endif
}
Expand All @@ -68,7 +68,7 @@ - (void)setMinimumNumberOfTouches:(NSUInteger)minimumNumberOfTouches

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

#ifndef TARGET_OS_TV
#if !TARGET_OS_TV
APPLY_NAMED_INT_PROP(minimumNumberOfTouches, @"minPointers");
APPLY_NAMED_INT_PROP(maximumNumberOfTouches, @"maxPointers");
#endif
Expand Down
4 changes: 2 additions & 2 deletions ios/Handlers/RNPinchHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ @implementation RNPinchGestureHandler
- (instancetype)initWithTag:(NSNumber *)tag
{
if ((self = [super initWithTag:tag])) {
#ifndef TARGET_OS_TV
#if !TARGET_OS_TV
_recognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)];
#endif
}
return self;
}

#ifndef TARGET_OS_TV
#if !TARGET_OS_TV
- (RNGestureHandlerEventExtraData *)eventExtraData:(UIPinchGestureRecognizer *)recognizer
{
return [RNGestureHandlerEventExtraData
Expand Down
5 changes: 2 additions & 3 deletions ios/Handlers/RNRotationHandler.m
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ @implementation RNRotationGestureHandler
- (instancetype)initWithTag:(NSNumber *)tag
{
if ((self = [super initWithTag:tag])) {
#ifndef TARGET_OS_TV
#if !TARGET_OS_TV
_recognizer = [[UIRotationGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)];
#endif
}
return self;
}

#ifndef TARGET_OS_TV
_recognizer = [[UIRotation
#if !TARGET_OS_TV
- (RNGestureHandlerEventExtraData *)eventExtraData:(UIRotationGestureRecognizer *)recognizer
{
return [RNGestureHandlerEventExtraData
Expand Down

0 comments on commit cb33bc9

Please sign in to comment.