Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Correctly attach root view recognizer in modals on iOS (#2498)
## Description On iOS, the conditions to attach `RootViewGestureRecognizer` were satisfied neither on the new nor the old architecture. This PR changes this logic: - unifies extracting the RN's touch handler to simply loop on all recognizers attached to the root view, as it works in every case - adds a check for `ModalHostViewController` when attaching the root view recognizer and if the view is in the modal the logic is different: - on the old arch: [RCTModalHostView](https://github.com/facebook/react-native/blob/b50874cad41f06519a263fa53d15f76c836fd167/packages/react-native/React/Views/RCTModalHostView.m#L95-L100) has a `UIView` as its child, and this one may only have one `RCTView` as its child - this one has the `RCTTouchHandler` recognizer attached - on the new arch: [RCTFabricModalHostViewController](https://github.com/facebook/react-native/blob/b50874cad41f06519a263fa53d15f76c836fd167/packages/react-native/React/Fabric/Mounting/ComponentViews/Modal/RCTFabricModalHostViewController.mm#L42) directly attaches `RCTSurfaceTouchHandler` to its direct subview Fixes #2487. ## Test plan Tested on Example and FabricExample apps and on the code from the issue. --------- Co-authored-by: Tomek Zawadzki <tomekzawadzki98@gmail.com>
- Loading branch information