Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -192,13 +192,22 @@ - (void)unbindFromView
[super unbindFromView];
}

- (BOOL)shouldSuppressActiveEvent:(RNGestureHandlerEventExtraData *)extraData
{
if (_lastActiveExtraData != nil && [_lastActiveExtraData.data isEqualToDictionary:extraData.data]) {
return YES;
}

_lastActiveExtraData = extraData;
return NO;
}

- (void)sendActiveStateEventIfChangedForView:(UIView *)sender extraData:(RNGestureHandlerEventExtraData *)extraData
{
if ([_lastActiveExtraData.data isEqualToDictionary:extraData.data]) {
if ([self shouldSuppressActiveEvent:extraData]) {
return;
}

_lastActiveExtraData = extraData;
[self sendEventsInState:RNGestureHandlerStateActive forViewWithTag:sender.reactTag withExtraData:extraData];
}

Expand Down Expand Up @@ -245,7 +254,6 @@ - (void)handleTouchDown:(UIView *)sender forEvent:(UIEvent *)event
withNumberOfTouches:event.allTouches.count
withPointerType:_pointerType]];

_lastActiveExtraData = nil;
[self sendActiveStateEventIfChangedForView:sender
extraData:[RNGestureHandlerEventExtraData forPointerInside:YES
withNumberOfTouches:event.allTouches.count
Expand Down Expand Up @@ -330,7 +338,13 @@ - (BOOL)wantsToAttachDirectlyToView
return YES;
}

#else
- (void)reset
{
[super reset];
_lastActiveExtraData = nil;
}
Comment on lines +341 to +345
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to be sure, but this is called when attached to UIControls, right?


#endif

- (RNGestureHandlerEventExtraData *)eventExtraData:(RNDummyGestureRecognizer *)recognizer
{
Expand All @@ -339,6 +353,4 @@ - (RNGestureHandlerEventExtraData *)eventExtraData:(RNDummyGestureRecognizer *)r
withPointerType:RNGestureHandlerMouse];
}

#endif

@end
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@
- (void)setConfig:(nullable NSDictionary *)config NS_REQUIRES_SUPER;
- (void)updateConfig:(nullable NSDictionary *)config NS_REQUIRES_SUPER;
- (void)updateRelations:(nonnull NSDictionary *)relations;
- (BOOL)shouldSuppressActiveEvent:(nonnull RNGestureHandlerEventExtraData *)extraData;
- (void)handleGesture:(nonnull id)recognizer;
- (void)handleGesture:(nonnull id)recognizer fromReset:(BOOL)fromReset;
- (void)handleGesture:(nonnull id)recognizer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,11 @@ - (RNGHUIView *)chooseViewForInteraction:(UIGestureRecognizer *)recognizer
return [self isViewParagraphComponent:recognizer.view] ? recognizer.view.subviews[0] : recognizer.view;
}

- (BOOL)shouldSuppressActiveEvent:(RNGestureHandlerEventExtraData *)extraData
{
return NO;
}

- (void)handleGesture:(UIGestureRecognizer *)recognizer
{
[self handleGesture:recognizer fromReset:NO];
Expand Down Expand Up @@ -368,6 +373,10 @@ - (void)handleGesture:(UIGestureRecognizer *)recognizer

RNGestureHandlerEventExtraData *eventData = [self eventExtraData:recognizer];

if (state == RNGestureHandlerStateActive && [self shouldSuppressActiveEvent:eventData]) {
return;
}

NSNumber *tag = [self chooseViewForInteraction:recognizer].reactTag;

if (tag == nil && _actionType == RNGestureHandlerActionTypeNativeDetector) {
Expand Down
Loading