dillon1000/react

Commit

Removed optimization for events without target in ReactNativeEventEmitter (#9219)

* Removed optimization for events without target in ReactNativeEventEmitter

This PR fixes the problem originally introduced in https://github.com/facebook/react/pull/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: https://github.com/facebook/react-native/issues/12976 .

The test also illustrates this problem.

* Prettier
Browse files
Changed paths3 files
First-parent comparison
M scripts/fiber/tests-passing.txt ModifiedM src/renderers/native/ReactNativeEventEmitter.js ModifiedM src/renderers/native/__tests__/ReactNativeEvents-test.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…