Fix scrollview content staying non-interactive after slowly swiping down (#597)
This was noticed when updating contained SwiftUI views rapidly. This change is what fixed a certain bug the scroll content can be locked at a negative offset. It was most obvious when the whitespace was large, hence the offset was something around -100.0. At the same time, the contents (like buttons) were non-interactive. Co-authored-by: Sören Gade <soeren.gade@lichtblick.de>
This commit is contained in:
+5
-1
@@ -1079,7 +1079,11 @@ class Core: NSObject, UIGestureRecognizerDelegate {
|
||||
// Must use setContentOffset(_:animated) to force-stop deceleration
|
||||
guard let scrollView = scrollView else { return }
|
||||
var offset = scrollView.contentOffset
|
||||
setValue(contentOffset, to: &offset)
|
||||
if contentOffset.y >= 0 {
|
||||
setValue(contentOffset, to: &offset)
|
||||
} else {
|
||||
offset = CGPoint(x: 0, y: 0)
|
||||
}
|
||||
scrollView.setContentOffset(offset, animated: false)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user