feat(ios): optional tradeoff to fix ios input delay#1665
feat(ios): optional tradeoff to fix ios input delay#1665pichillilorenzo merged 1 commit intopichillilorenzo:masterfrom
Conversation
|
Any opinions on this @pichillilorenzo? |
|
Any chance of this getting merged? |
|
Any update @pichillilorenzo? |
|
@pichillilorenzo let me know if anything needs to be done here |
|
@andreasgangso I was trying this fix but currently, I don't see any delay improvements in using Instead, adding this code inside public override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
// other code ...
if let gestures = superview?.superview?.gestureRecognizers {
for gesture in gestures {
if NSStringFromClass(type(of: gesture)) == "DelayingGestureRecognizer" {
gesture.isEnabled = false
}
}
}
// other code ...
}it seems to work. I can update this code to work with |
|
About the tradeoffs, it seems to work correctly also with flutter widgets that are over the webview, such as I'm using Flutter 3.13.8 |
|
@all-contributors please add @andreasgangso for code |
|
I've put up a pull request to add @andreasgangso! 🎉 |
|
I still see the delay problem. Have the problem been really fixed in v6.0.0-beta.28? Thanks |
Are you using the |
|
@codemobiles using the InAppWebView.preventGestureDelay parameter. It should disable the Flutter native delay gesture. |
|
Thanks so much. I forgot to set preventGestureDelay first. ex: InAppWebView(...preventGestureDelay: true,); It fixed the problem. @andreasgangso @pichillilorenzo |
|
On version 6.1.5, the preventGestureDelay parameter seems to have no effect. |
Any reason you're not using |
Connection with issue(s)
Resolves issue #1268
Possibly connected to #216
Testing and Review Notes
Description
There's a very noticable input delay on iOS which is not usable if you want websites with a lot of gestures (e.g. games or similar). To test, simply have a website with a button and see how long it takes to click it before and after enabling the new
preventGestureDelayflag.Cause
I understand this is somehow caused by flutter's DelayingGestureRecognizer.
I honestly don't understand what makes the "WaitUntilTouchesEnded" policy work better here, but it removes the delay.
Other solutions include disabling the DelayingGestureRecognizer completely, but that's very hacky compared to using an official option.
I see google maps is using this policy, so it can't be too bad?
https://github.com/flutter/packages/blob/d449a17f8706850388a16d8acc72398c2118cf9a/packages/google_maps_flutter/google_maps_flutter_ios/ios/Classes/FLTGoogleMapsPlugin.m#L16
Tradeoffs
I put this behind the optional flag
preventGestureDelaybecause this has 1 known tradeoff.This makes the gestures to always fall through to the webview, even if there are opaque widgets stacked on top of it (see
flutter/flutter#94325 (comment))
To Do