Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compatibility with TV #475

Merged
merged 2 commits into from
Feb 28, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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