Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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 @@ -53,13 +53,21 @@ - (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
_lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
[super touchesEnded:touches withEvent:event];
[_gestureHandler.pointerTracker touchesEnded:touches withEvent:event];

if (iOS_VERSION >= 26.0) {
[self triggerAction];
}
}

- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
_lastPoint = [[[touches allObjects] objectAtIndex:0] locationInView:_gestureHandler.recognizer.view];
[super touchesCancelled:touches withEvent:event];
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];

if (iOS_VERSION >= 26.0) {
[self triggerAction];
}
}

- (void)triggerAction
Expand All @@ -69,7 +77,14 @@ - (void)triggerAction

- (void)reset
{
#if TARGET_OS_IOS
if (iOS_VERSION < 26.0) {
[self triggerAction];
}
#else
[self triggerAction];
#endif

[_gestureHandler.pointerTracker reset];
_hasBegan = NO;
[super reset];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,20 @@ - (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
[_gestureHandler.pointerTracker touchesEnded:touches withEvent:event];

if (iOS_VERSION >= 26.0 && self.state == UIGestureRecognizerStateFailed) {
[self triggerAction];
}
}

- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
[super touchesCancelled:touches withEvent:event];
[_gestureHandler.pointerTracker touchesCancelled:touches withEvent:event];

if (iOS_VERSION >= 26.0 && self.state == UIGestureRecognizerStateFailed) {
[self triggerAction];
}
}

#else
Expand Down Expand Up @@ -181,9 +189,13 @@ - (BOOL)shouldCancelGesture

- (void)reset
{
if (self.state == UIGestureRecognizerStateFailed) {
#if TARGET_OS_IOS
if (iOS_VERSION < 26.0 && self.state == UIGestureRecognizerStateFailed) {
[self triggerAction];
}
#else
[self triggerAction];
#endif

[_gestureHandler.pointerTracker reset];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,19 +243,34 @@ - (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
[self interactionsEnded:touches withEvent:event];

if (iOS_VERSION >= 26.0) {
[self triggerAction];
}
}

- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
[super touchesCancelled:touches withEvent:event];
[self interactionsCancelled:touches withEvent:event];

if (iOS_VERSION >= 26.0) {
[self triggerAction];
}
}

#endif

- (void)reset
{
#if TARGET_OS_IOS
if (iOS_VERSION < 26.0) {
[self triggerAction];
}
#else
[self triggerAction];
#endif

[_gestureHandler.pointerTracker reset];
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(activateAfterLongPress) object:nil];
self.enabled = YES;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,20 @@ - (void)touchesEnded:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
[super touchesEnded:touches withEvent:event];
[self interactionsEnded:touches withEvent:event];

if (iOS_VERSION >= 26.0 && self.state == UIGestureRecognizerStateFailed) {
[self triggerAction];
}
}

- (void)touchesCancelled:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
[super touchesCancelled:touches withEvent:event];
[self interactionsCancelled:touches withEvent:event];

if (iOS_VERSION >= 26.0 && self.state == UIGestureRecognizerStateFailed) {
[self triggerAction];
}
}

#endif
Expand Down Expand Up @@ -243,9 +251,14 @@ - (BOOL)shouldFailUnderCustomCriteria

- (void)reset
{
if (self.state == UIGestureRecognizerStateFailed) {
#if TARGET_OS_IOS
if (iOS_VERSION < 26.0 && self.state == UIGestureRecognizerStateFailed) {
[self triggerAction];
}
#else
[self triggerAction];
#endif

[_gestureHandler.pointerTracker reset];

[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(cancel) object:nil];
Expand Down
2 changes: 2 additions & 0 deletions packages/react-native-gesture-handler/apple/RNGHUIKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ typedef UIScrollView RNGHUIScrollView;
#define RNGHGestureRecognizerStateBegan UIGestureRecognizerStateBegan;
#define RNGHGestureRecognizerStateEnded UIGestureRecognizerStateEnded;

#define iOS_VERSION [[[UIDevice currentDevice] systemVersion] floatValue]
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now, since iOS_VERSION macro returns float, we may want to do comparisons up to a constant $\epsilon$, or round this value. I don't think it is necessary at this point, but let me know what you think.

Copy link
Contributor

Choose a reason for hiding this comment

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

I dont't really see a case where this would be an issue. I know floats behave weirdly, but we will always be checking it via a \leq or \geq comparison with another float and and the mapping from real values to floats is monotonic - it keeps the ordering.


#else // TARGET_OS_OSX [

#import <React/RCTUIKit.h>
Expand Down
Loading