https://github.com/pichillilorenzo/flutter_inappwebview/issues/1947 - In iOS version 17.2, when moving the input focus in a WebView, an unknown area appears at the top of the screen.
This commit is contained in:
parent
4c58653113
commit
3ff3bb1681
|
@ -728,6 +728,15 @@ public class InAppWebView: WKWebView, UIScrollViewDelegate, WKUIDelegate,
|
|||
let newContentOffset = change?[.newKey] as? CGPoint
|
||||
let oldContentOffset = change?[.oldKey] as? CGPoint
|
||||
let startedByUser = scrollView.isDragging || scrollView.isDecelerating
|
||||
// zpdl9089 : https://github.com/pichillilorenzo/flutter_inappwebview/issues/1947
|
||||
if #available(iOS 17.2, *) {
|
||||
if let y = newContentOffset?.y {
|
||||
if(!startedByUser && scrollView.contentInset.bottom < 0.0 && y <= scrollView.contentInset.bottom) {
|
||||
scrollView.contentOffset = oldContentOffset ?? .zero
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
if newContentOffset != oldContentOffset {
|
||||
DispatchQueue.main.async {
|
||||
self.onScrollChanged(startedByUser: startedByUser, oldContentOffset: oldContentOffset)
|
||||
|
|
Loading…
Reference in New Issue