[CP-beta][ios]Do not re-add delaying recognizer on iOS 26 (#175299)

This pull request is created by [automatic cherry pick workflow](https://github.com/flutter/flutter/blob/main/docs/releases/Flutter-Cherrypick-Process.md#automatically-creates-a-cherry-pick-request)
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.

### Issue Link:
What is the link to the issue this cherry-pick is addressing?

https://github.com/flutter/flutter/issues/174513

### Changelog Description:
Explain this cherry pick in one line that is accessible to most Flutter developers. See [best practices](https://github.com/flutter/flutter/blob/main/docs/releases/Hotfix-Documentation-Best-Practices.md) for examples

Fix a bug where platform view's gesture blocking fails to work on iOS 26

### Impact Description:
What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch)

All platform views (e.g. web view, map, etc) on iOS 26

### Workaround:
Is there a workaround for this issue?

No

### Risk:
What is the risk level of this cherry-pick?

### Test Coverage:
Are you confident that your fix is well-tested by automated tests?

### Validation Steps:
What are the steps to validate that this fix works?

As explained in the linked issue above, interact with the flutter UI on top of the platform view. Notice that the platform view still receives the touches, despite that the platform view is under flutter UI and it shouldn't receive the touches. This only happens on iOS 26.
This commit is contained in:
flutteractionsbot 2025-09-15 10:40:04 -07:00 committed by GitHub
parent 51c836fdea
commit 286e592194
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 3 deletions

View File

@ -587,7 +587,11 @@ static BOOL _preparedOnce = NO;
// from the web view plugin level. Right now we only observe this issue for
// FlutterPlatformViewGestureRecognizersBlockingPolicyEager, but we should try it if a similar
// issue arises for the other policy.
if (@available(iOS 18.2, *)) {
if (@available(iOS 26.0, *)) {
// This workaround does not work on iOS 26.
// TODO(hellohuanlin): find a solution for iOS 26,
// https://github.com/flutter/flutter/issues/175099.
} else if (@available(iOS 18.2, *)) {
// This workaround is designed for WKWebView only. The 1P web view plugin provides a
// WKWebView itself as the platform view. However, some 3P plugins provide wrappers of
// WKWebView instead. So we perform DFS to search the view hierarchy (with a depth limit).

View File

@ -3198,7 +3198,14 @@ fml::RefPtr<fml::TaskRunner> GetDefaultTaskRunner() {
[(FlutterTouchInterceptingView*)touchInteceptorView blockGesture];
if (@available(iOS 18.2, *)) {
BOOL shouldReAddDelayingRecognizer = NO;
if (@available(iOS 26.0, *)) {
// TODO(hellohuanlin): find a solution for iOS 26,
// https://github.com/flutter/flutter/issues/175099.
} else if (@available(iOS 18.2, *)) {
shouldReAddDelayingRecognizer = YES;
}
if (shouldReAddDelayingRecognizer) {
// Since we remove and add back delayingRecognizer, it would be reordered to the last.
XCTAssertEqual(touchInteceptorView.gestureRecognizers[0], forwardingRecognizer);
XCTAssertEqual(touchInteceptorView.gestureRecognizers[1], delayingRecognizer);
@ -3261,7 +3268,14 @@ fml::RefPtr<fml::TaskRunner> GetDefaultTaskRunner() {
[(FlutterTouchInterceptingView*)touchInteceptorView blockGesture];
if (@available(iOS 18.2, *)) {
BOOL shouldReAddDelayingRecognizer = NO;
if (@available(iOS 26.0, *)) {
// TODO(hellohuanlin): find a solution for iOS 26,
// https://github.com/flutter/flutter/issues/175099.
} else if (@available(iOS 18.2, *)) {
shouldReAddDelayingRecognizer = YES;
}
if (shouldReAddDelayingRecognizer) {
// Since we remove and add back delayingRecognizer, it would be reordered to the last.
XCTAssertEqual(touchInteceptorView.gestureRecognizers[0], forwardingRecognizer);
XCTAssertEqual(touchInteceptorView.gestureRecognizers[1], delayingRecognizer);