Tweak compose text view scrolling behavior
This commit is contained in:
parent
fc888b168c
commit
80cca7673a
|
@ -211,9 +211,10 @@ struct MainComposeWrappedTextView: UIViewRepresentable {
|
|||
let cursorRect = textView.caretRect(for: range.start)
|
||||
var rectToMakeVisible = textView.convert(cursorRect, to: scrollView)
|
||||
|
||||
// move Y position of the rect that will be made visible down by the cursor's height so that there's
|
||||
// expand the rect to be three times the cursor height centered on the cursor so that there's
|
||||
// some space between the bottom of the line of text being edited and the top of the keyboard
|
||||
rectToMakeVisible.origin.y += cursorRect.height
|
||||
rectToMakeVisible.origin.y -= cursorRect.height
|
||||
rectToMakeVisible.size.height *= 3
|
||||
|
||||
let animator = UIViewPropertyAnimator(duration: 0.1, curve: .linear) {
|
||||
scrollView.scrollRectToVisible(rectToMakeVisible, animated: false)
|
||||
|
|
Loading…
Reference in New Issue