Skip to content

Commit ea92ad7

Browse files
authored
Add the possibility to customize the cornerRadius of the ComposeInputView (#272)
Co-authored-by: Michael Freiwald <[email protected]>
1 parent f7d2763 commit ea92ad7

File tree

4 files changed

+10
-2
lines changed

4 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
77
- Possibility to customize message reactions top padding (for grid-based reaction containers)
88
- Custom sorting of reactions
99
- Added a configurable separator view for new messages
10+
- Possibility to customize the cornerRadius of the `ComposerInputView`
1011

1112
# [4.26.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.26.0)
1213
_January 16, 2023_

Sources/StreamChatSwiftUI/ChatChannel/Composer/ComposerConfig.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,19 +9,22 @@ public struct ComposerConfig {
99

1010
public var inputViewMinHeight: CGFloat
1111
public var inputViewMaxHeight: CGFloat
12+
public var inputViewCornerRadius: CGFloat
1213
public var inputFont: UIFont
1314
public var adjustMessageOnSend: (String) -> (String)
1415
public var adjustMessageOnRead: (String) -> (String)
1516

1617
public init(
1718
inputViewMinHeight: CGFloat = 38,
1819
inputViewMaxHeight: CGFloat = 76,
20+
inputViewCornerRadius: CGFloat = 20,
1921
inputFont: UIFont = UIFont.preferredFont(forTextStyle: .body),
2022
adjustMessageOnSend: @escaping (String) -> (String) = { $0 },
2123
adjustMessageOnRead: @escaping (String) -> (String) = { $0 }
2224
) {
2325
self.inputViewMinHeight = inputViewMinHeight
2426
self.inputViewMaxHeight = inputViewMaxHeight
27+
self.inputViewCornerRadius = inputViewCornerRadius
2528
self.inputFont = inputFont
2629
self.adjustMessageOnSend = adjustMessageOnSend
2730
self.adjustMessageOnRead = adjustMessageOnRead

Sources/StreamChatSwiftUI/ChatChannel/Composer/MessageComposerView.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -343,11 +343,11 @@ public struct ComposerInputView<Factory: ViewFactory>: View {
343343
.padding(.leading, 8)
344344
.background(composerInputBackground)
345345
.overlay(
346-
RoundedRectangle(cornerRadius: 20)
346+
RoundedRectangle(cornerRadius: TextSizeConstants.cornerRadius)
347347
.stroke(Color(colors.innerBorder))
348348
)
349349
.clipShape(
350-
RoundedRectangle(cornerRadius: 20)
350+
RoundedRectangle(cornerRadius: TextSizeConstants.cornerRadius)
351351
)
352352
.accessibilityIdentifier("ComposerInputView")
353353
}

Sources/StreamChatSwiftUI/Utils/Common/InputTextView.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,10 @@ struct TextSizeConstants {
1818
static var minThreshold: CGFloat {
1919
composerConfig.inputViewMinHeight
2020
}
21+
22+
static var cornerRadius: CGFloat {
23+
composerConfig.inputViewCornerRadius
24+
}
2125
}
2226

2327
class InputTextView: UITextView, AccessibilityView {

0 commit comments

Comments
 (0)