-
-
Notifications
You must be signed in to change notification settings - Fork 984
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make blocksGesture
symmetric on native iOS
#3322
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good!
What I'd suggest is to move this nil
check before other checks, like this:
code
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer
shouldRequireFailureOfGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
{
RNGestureHandler *handler = [RNGestureHandler findGestureHandlerByRecognizer:otherGestureRecognizer];
if(handler == nil) {
return NO;
}
if ([_handlersToWaitFor count]) {
for (NSNumber *handlerTag in _handlersToWaitFor) {
if ([handler.tag isEqual:handlerTag]) {
return YES;
}
}
}
for (NSNumber *handlerTag in handler->_handlersThatShouldWait) {
if ([_tag isEqual:handlerTag]) {
return YES;
}
}
return NO;
}
or at least combine it with and
:
if (handler != nil && [_handlersToWaitFor count]) {
apple/RNGestureHandler.mm
Outdated
for (NSNumber *handlerTag in handler->_handlersThatShouldWait) { | ||
if ([_tag isEqual:handlerTag]) { | ||
return YES; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't we also check [_handlersThatShouldWait count]
, as above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I moved the null check up and removed the check for [_handlersThatShouldWait count]
entirely - I don't really see the difference it makes when the list is empty.
Yes, this does seem to resolve the issue! |
Curiously, moving to Edit: here's the Android issue, #3326 |
Description
Should fix #3321
This PR makes the native implementation of
blocksGesture
symmetric. Previously, the logic was implemented only inshouldBeRequiredToFailByGestureRecognizer
, now, it's also inshouldRequireFailureOfGestureRecognizer
.Test plan
Tested on the code from the issue