From b1b53aad8b75afd6fd18276671a8d5cea572fcc2 Mon Sep 17 00:00:00 2001 From: Martin Kralik Date: Fri, 1 Apr 2016 06:53:11 -0700 Subject: [PATCH] coalescingKeys for RCTTouchEvent Reviewed By: javache Differential Revision: D3092864 fb-gh-sync-id: b703dca92578e05195eac9171b5b6eee83976cc9 fbshipit-source-id: b703dca92578e05195eac9171b5b6eee83976cc9 --- React/Base/RCTTouchHandler.m | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/React/Base/RCTTouchHandler.m b/React/Base/RCTTouchHandler.m index 05fce0f3a..e9d2e20de 100644 --- a/React/Base/RCTTouchHandler.m +++ b/React/Base/RCTTouchHandler.m @@ -39,6 +39,7 @@ BOOL _dispatchedInitialTouches; BOOL _recordingInteractionTiming; CFTimeInterval _mostRecentEnqueueJS; + uint16_t _coalescingKey; } - (instancetype)initWithBridge:(RCTBridge *)bridge @@ -200,7 +201,7 @@ typedef NS_ENUM(NSInteger, RCTTouchEventType) { RCTTouchEvent *event = [[RCTTouchEvent alloc] initWithEventName:eventName reactTouches:reactTouches changedIndexes:changedIndexes - coalescingKey:0]; + coalescingKey:_coalescingKey]; [_eventDispatcher sendEvent:event]; } @@ -233,6 +234,7 @@ static BOOL RCTAnyTouchesChanged(NSSet *touches) { // If gesture just recognized, send all touches to JS as if they just began. if (self.state == UIGestureRecognizerStateBegan) { + _coalescingKey++; [self _updateAndDispatchTouches:_nativeTouches.set eventName:@"topTouchStart" originatingTime:0]; // We store this flag separately from `state` because after a gesture is