Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 3.26.1

* Fixes web views on iOS becoming unresponsive to touches after the first
interaction by registering the platform view with the hit-test based gesture
blocking policy.

## 3.26.0

* Adds new method for accessing a native `WKWebView` from a `FlutterPluginRegistrar`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,16 @@ import WebKit
forIdentifier: 0, withPluginRegistrar: registrar)
#expect(result == nil)
}

@MainActor @Test func registersViewFactoryWithHitTestGesturePolicy() throws {
let registrar = TestFlutterPluginRegistrar()

WebViewFlutterPlugin.register(with: registrar)

#expect(
registrar.registeredGestureRecognizersBlockingPolicy
== FlutterPlatformViewGestureRecognizersBlockingPolicyDoNotBlockGesture)
}
#endif
}

Expand Down Expand Up @@ -128,6 +138,8 @@ class TestFlutterPluginRegistrar: NSObject, FlutterPluginRegistrar {

#if os(iOS)
var viewController: UIViewController?
var registeredGestureRecognizersBlockingPolicy:
FlutterPlatformViewGestureRecognizersBlockingPolicy?

func messenger() -> FlutterBinaryMessenger {
return TestBinaryMessenger()
Expand All @@ -145,6 +157,7 @@ class TestFlutterPluginRegistrar: NSObject, FlutterPluginRegistrar {
_ factory: FlutterPlatformViewFactory, withId factoryId: String,
gestureRecognizersBlockingPolicy: FlutterPlatformViewGestureRecognizersBlockingPolicy
) {
registeredGestureRecognizersBlockingPolicy = gestureRecognizersBlockingPolicy
}

func addSceneDelegate(_ delegate: any FlutterSceneLifeCycleDelegate) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,20 @@ public class WebViewFlutterPlugin: NSObject, FlutterPlugin {
registrar.addSceneDelegate(plugin)
#endif

registrar.register(viewFactory, withId: "plugins.flutter.io/webview")
#if os(iOS)
// The default `eager` policy blocks the platform view's gesture
// recognizers through Flutter's gesture arena, which is stateful. When
// that state is stranded the web view stops receiving touches for the
// rest of its lifetime. `doNotBlockGesture` derives the same decision
// from hit testing instead, so there is no state left to strand.
// See https://github.com/flutter/flutter/issues/175099.
registrar.register(
viewFactory, withId: "plugins.flutter.io/webview",
gestureRecognizersBlockingPolicy:
FlutterPlatformViewGestureRecognizersBlockingPolicyDoNotBlockGesture)
#else
registrar.register(viewFactory, withId: "plugins.flutter.io/webview")
#endif
registrar.publish(plugin)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: webview_flutter_wkwebview
description: A Flutter plugin that provides a WebView widget based on Apple's WKWebView control.
repository: https://github.com/flutter/packages/tree/main/packages/webview_flutter/webview_flutter_wkwebview
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+webview%22
version: 3.26.0
version: 3.26.1

environment:
sdk: ^3.12.0
Expand Down