File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
Sources/StreamChatSwiftUI/ChatChannel Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ import UIKit
7
7
8
8
/// SwiftUI wrapper for a text field with multiple rows.
9
9
struct ComposerTextInputView : UIViewRepresentable {
10
+
11
+ @Injected ( \. utils) private var utils
12
+
10
13
@Binding var text : String
11
14
@Binding var height : CGFloat
12
15
@Binding var selectedRangeLocation : Int
@@ -24,6 +27,10 @@ struct ComposerTextInputView: UIViewRepresentable {
24
27
inputTextView. placeholderLabel. text = placeholder
25
28
inputTextView. contentInsetAdjustmentBehavior = . never
26
29
30
+ if utils. messageListConfig. becomesFirstResponderOnOpen {
31
+ inputTextView. becomeFirstResponder ( )
32
+ }
33
+
27
34
return inputTextView
28
35
}
29
36
Original file line number Diff line number Diff line change @@ -16,7 +16,8 @@ public struct MessageListConfig {
16
16
dateIndicatorPlacement: DateIndicatorPlacement = . overlay,
17
17
pageSize: Int = 50 ,
18
18
messagePopoverEnabled: Bool = true ,
19
- doubleTapOverlayEnabled: Bool = false
19
+ doubleTapOverlayEnabled: Bool = false ,
20
+ becomesFirstResponderOnOpen: Bool = false
20
21
) {
21
22
self . messageListType = messageListType
22
23
self . typingIndicatorPlacement = typingIndicatorPlacement
@@ -27,6 +28,7 @@ public struct MessageListConfig {
27
28
self . pageSize = pageSize
28
29
self . messagePopoverEnabled = messagePopoverEnabled
29
30
self . doubleTapOverlayEnabled = doubleTapOverlayEnabled
31
+ self . becomesFirstResponderOnOpen = becomesFirstResponderOnOpen
30
32
}
31
33
32
34
let messageListType : MessageListType
@@ -38,6 +40,7 @@ public struct MessageListConfig {
38
40
let pageSize : Int
39
41
let messagePopoverEnabled : Bool
40
42
let doubleTapOverlayEnabled : Bool
43
+ let becomesFirstResponderOnOpen : Bool
41
44
}
42
45
43
46
/// Contains information about the message paddings.
You can’t perform that action at this time.
0 commit comments