[iOS]fix touch event conflict
diff --git a/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m b/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m
index 34f0c69..d7b594c 100644
--- a/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m
+++ b/ios/sdk/WeexSDK/Sources/Events/WXComponent+Events.m
@@ -93,6 +93,7 @@
@property (nonatomic, assign) BOOL listenTouchEnd;
@property (nonatomic, assign) BOOL listenTouchCancel;
@property (nonatomic, assign) BOOL listenPseudoTouch;
+@property (nonatomic, assign) NSInteger activeTouches;
- (instancetype)initWithComponent:(WXComponent *)component NS_DESIGNATED_INITIALIZER;
@@ -914,6 +915,7 @@
_listenTouchEnd = NO;
_listenTouchMove = NO;
_listenTouchCancel = NO;
+ _activeTouches = 0;
self.cancelsTouchesInView = NO;
}
@@ -933,6 +935,10 @@
[_component updatePseudoClassStyles:styles];
}
+ _activeTouches += [touches count];
+ if (_activeTouches > (NSInteger)[event.allTouches count]) {
+ _activeTouches = [event.allTouches count];
+ }
}
- (void)touchesMoved:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
@@ -956,6 +962,11 @@
[self recoveryPseudoStyles:_component.styles];
}
+ _activeTouches -= [touches count];
+ if (_activeTouches <= 0) {
+ self.state = UIGestureRecognizerStateEnded;
+ _activeTouches = 0;
+ }
}
- (void)touchesCancelled:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
@@ -968,6 +979,12 @@
if(_listenPseudoTouch) {
[self recoveryPseudoStyles:_component.styles];
}
+
+ _activeTouches -= [touches count];
+ if (_activeTouches <= 0) {
+ self.state = UIGestureRecognizerStateEnded;
+ _activeTouches = 0;
+ }
}
- (void)fireTouchEvent:(NSString *)eventName withTouches:(NSSet<UITouch *> *)touches