-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Removed optimization for events without target in ReactNativeEventEmitter #9219
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.
This looks good though I'm unsure about the test.
(I would have liked to match this change in the corresponding DOM code at src/renderers/dom/shared/ReactEventListener.js handleTopLevelImpl but it seems like maybe the logic there is different enough due to the nested roots logic that it is probably fine to leave them separate.)
|
||
expect(getResponderId()).toBe(null); | ||
|
||
expect(log).toEqual([ |
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.
Not sure if I'm missing something obvious, but how does this test the codepath in question? It seems to me that the simulated touches you have both hit mounted views.
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.
Thank you for feedback, Ben!
I changed the test to match the original conditions.
…tter This PR fixes the problem originally introduced in facebook#6590 The problem is that `ResponderEventPlugin` (and `ResponderTouchHistoryStore`) relies on that fact that touch events are balanced. So if one `startish` event happened, should be coming `endish` event. Otherwise there is no way to maintain internal `trackedTouchCount` counter. So, if we drop some events, we break this logic. Moreover, that optimization clearly contradict with this statement from `ResponderEventPlugin`: ``` We must be resilient to `targetInst` being `null` on `touchMove` or `touchEnd`. On certain platforms, this means that a native scroll has assumed control and the original touch targets are destroyed. ``` This issue causes several major problems in React Native, and one of them (finally!) is easy to reproduce: facebook/react-native#12976 . The test also illustrates this problem.
Thanks! |
This PR fixes the problem originally introduced in #6590
The problem is that
ResponderEventPlugin
(andResponderTouchHistoryStore
) relies on that fact that touch events are balanced.So if one
startish
event happened, should be comingendish
event. Otherwise there is no way to maintain internaltrackedTouchCount
counter. So, if we drop some events, we break this logic.Moreover, that optimization clearly contradict with this statement from
ResponderEventPlugin
:This issue causes several major problems in React Native, and one of them (finally!) is easy to reproduce: facebook/react-native#12976 .
The test also illustrates this problem.
@spicyj, please review. 😄