Skip to content

Commit 28400f1

Browse files
Fixed scroll to bottom when return key is pressed
1 parent a5b86ea commit 28400f1

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66
### ✅ Added
77
- Support for specifying whether ChatChannelListView is embedded in a NavigationView with `embedInNavigationView`
88

9+
### 🔄 Changed
10+
- Public init for `DefaultChannelListHeaderModifier`
11+
12+
### 🐞 Fixed
13+
- Scroll to bottom when return key is pressed in the composer input view
14+
915
# [4.23.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.23.0)
1016
_October 27, 2022_
1117

Sources/StreamChatSwiftUI/ChatChannel/Composer/ComposerTextInputView.swift

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,12 +58,6 @@ struct ComposerTextInputView: UIViewRepresentable {
5858
if uiView.contentSize.height != height {
5959
uiView.contentSize.height = height
6060
}
61-
62-
let previous = uiView.isScrollEnabled
63-
uiView.isScrollEnabled = height > currentHeight
64-
if previous == false && previous != uiView.isScrollEnabled {
65-
uiView.scrollToBottom()
66-
}
6761
}
6862
}
6963
}

Sources/StreamChatSwiftUI/Utils/Common/InputTextView.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ class InputTextView: UITextView, AccessibilityView {
9797
)
9898
)
9999
placeholderLabel.pin(anchors: [.centerY], to: self)
100-
isScrollEnabled = false
100+
isScrollEnabled = true
101101
}
102102

103103
/// Sets the given text in the current caret position.
@@ -140,5 +140,8 @@ class InputTextView: UITextView, AccessibilityView {
140140
override open func paste(_ sender: Any?) {
141141
super.paste(sender)
142142
handleTextChange()
143+
DispatchQueue.main.asyncAfter(deadline: .now() + 0.3) { [weak self] in
144+
self?.scrollToBottom()
145+
}
143146
}
144147
}

0 commit comments

Comments
 (0)