mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
a9bc3853f0
Summary: Changelog: [internal] Previous implementation, (D25684453 (https://github.com/facebook/react-native/commit/eba31d285847ef70cf22ce83fe013efa95416e3c)) which was backed out, had a bug that caused assert to fail. It was restarting internal state `RCTSurfaceTouchHandler` and lead to inconsistency. This is because touch event is a state machine and before "moved" is called, touch event had to "began". With internal state being restarted, that wasn't the case. In the previous implementation the internal state was incorrectly restarted because I thought touches would not longer receive touch events after declaring that UIGestureRecogniser shouldn't be recognised simultaneously. In this diff I take a different approach. Instead of restarting the internal state, the recogniser is first disabled and then enabled again. This cancels any ongoing touches instead of manual cleanup. ### Other approaches In the UIViewController, we could listen to `viewWillDisappear` message and cancel any ongoing touches on the surface. This would work as well (it would prevent Pressable components from being highlighted during interactive view controller dismissal) however we would need to expose existence of `RCTTouchHandler` to the view controller. This approach is also discouraged in D15734129 (https://github.com/facebook/react-native/commit/36307d87e1974aff1abac598da2fd11c4e8e23c1). Reviewed By: shergin Differential Revision: D25685536 fbshipit-source-id: ad226c82e73f841c1ebd9b92738847cc5cdc21d1