-
-
Notifications
You must be signed in to change notification settings - Fork 518
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
fix(iOS, Fabric): add missing logic for finding touch handler #2193
Conversation
abfc9fb
to
fef6798
Compare
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.
Just a note for reviewers.
#define RNS_TOUCH_HANDLER_ARCH_TYPE RCTSurfaceTouchHandler | ||
#else | ||
#define RNS_TOUCH_HANDLER_ARCH_TYPE RCTTouchHandler |
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 tried using typedef
s instead of macros here, but stumbled upon issues with nullability (section about "audited regions") and had unexpected issues doing any casting for typedef'd types -> went for macros.
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.
LGTM
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.
LGTM! Just left two comments out there 👍
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.
If we're keeping in this file only TouchHandler-specific code, I would call this file as UIView+RNSTouchHandlers
.
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 used already existing category name - RNSUtility (we have already introduced this one), and I think it is better suited for future, as putting any more utility methods in RNSTouchHandlers
wouldn't make sense. It's again the matter of taste... I'll keep current version, but thanks for suggestion!
[touchHandler rnscreens_cancelTouches]; | ||
} | ||
#endif // RCT_NEW_ARCH_ENABLED | ||
[[self rnscreens_findTouchHandlerInAncestorChain] rnscreens_cancelTouches]; |
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.
Can we do something like:
RNS_TOUCH_HANDLER_ARCH_TYPE *touchHandler = [self rnscreens_findTouchHandlerInAncestorChain];
[touchHandler rnscreens_cancelTouches];
to improve readability?
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 find it quite opposite 😄 I'm mean the redundant variable strikes me => I'll stay by current version as this is taste related, but thanks.
## Description `- [RNSScreen touchHandler]` method was missing implementation for Fabric, adding it here. ## Changes - **Add category on UIView with code for touch handler finding** - **Use the new category to simplify implementation** ## Test code and steps to reproduce `Test2118` - tested on both archs & works just fine ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes
…sted stack (#2223) ## Description In #2193 I've made a mistake - on Paper, when there is no touch handler held in `_touchHandler` field I've started lookup for touch handler in ancestor chain from `self` -> which leads to infinite loop when swiping back in nested-stack navigation scenario. ## Changes * Started lookup from superview. ## Test code and steps to reproduce `Test2223` 1. Navigate to NestedStack. 2. Navigate to NestedStack details screen. 3. Use swipe gesture to go-back W/o this PR the application will crash hitting infinite loop. Also test that this behaviour remains fixed: * #2131 ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes
…re-mansion#2193) ## Description `- [RNSScreen touchHandler]` method was missing implementation for Fabric, adding it here. ## Changes - **Add category on UIView with code for touch handler finding** - **Use the new category to simplify implementation** ## Test code and steps to reproduce `Test2118` - tested on both archs & works just fine ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes
…sted stack (software-mansion#2223) ## Description In software-mansion#2193 I've made a mistake - on Paper, when there is no touch handler held in `_touchHandler` field I've started lookup for touch handler in ancestor chain from `self` -> which leads to infinite loop when swiping back in nested-stack navigation scenario. ## Changes * Started lookup from superview. ## Test code and steps to reproduce `Test2223` 1. Navigate to NestedStack. 2. Navigate to NestedStack details screen. 3. Use swipe gesture to go-back W/o this PR the application will crash hitting infinite loop. Also test that this behaviour remains fixed: * software-mansion#2131 ## Checklist - [x] Included code example that can be used to test this change - [x] Ensured that CI passes
Description
- [RNSScreen touchHandler]
method was missing implementation for Fabric, adding it here.Changes
Test code and steps to reproduce
Test2118
- tested on both archs & works just fineChecklist