34 lines
768 B
Objective-C
34 lines
768 B
Objective-C
#import "RNFlingHandler.h"
|
|
|
|
@implementation RNFlingGestureHandler
|
|
|
|
- (instancetype)initWithTag:(NSNumber *)tag
|
|
{
|
|
if ((self = [super initWithTag:tag])) {
|
|
_recognizer = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(handleGesture:)];
|
|
|
|
}
|
|
return self;
|
|
}
|
|
|
|
- (void)configure:(NSDictionary *)config
|
|
{
|
|
[super configure:config];
|
|
UISwipeGestureRecognizer *recognizer = (UISwipeGestureRecognizer *)_recognizer;
|
|
|
|
id prop = config[@"direction"];
|
|
if (prop != nil) {
|
|
recognizer.direction = [RCTConvert NSInteger:prop];
|
|
}
|
|
|
|
#if !TARGET_OS_TV
|
|
prop = config[@"numberOfPointers"];
|
|
if (prop != nil) {
|
|
recognizer.numberOfTouchesRequired = [RCTConvert NSInteger:prop];
|
|
}
|
|
#endif
|
|
}
|
|
|
|
@end
|
|
|