Skip to content

Commit bcf6563

Browse files
authored
Allow customization of minOriginY in the initializer of ReactionsOverlayView (#793)
1 parent c4bf4de commit bcf6563

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

44
# Upcoming
55

6+
### ✅ Added
7+
- Add `minOriginY` to the initializer of `ReactionsOverlayView` for better UI customization [#793](https://github.com/GetStream/stream-chat-swiftui/pull/793)
68
### 🔄 Changed
79

810
# [4.75.0](https://github.com/GetStream/stream-chat-swiftui/releases/tag/4.75.0)

Sources/StreamChatSwiftUI/ChatChannel/Reactions/ReactionsOverlayView.swift

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
3030
private var messageActionsCount: Int
3131
private let paddingValue: CGFloat = 16
3232
private let messageItemSize: CGFloat = 40
33+
private let minOriginY: CGFloat
3334
private var maxMessageActionsSize: CGFloat {
3435
screenHeight / 3
3536
}
@@ -39,6 +40,7 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
3940
channel: ChatChannel,
4041
currentSnapshot: UIImage,
4142
messageDisplayInfo: MessageDisplayInfo,
43+
minOriginY: CGFloat = 100,
4244
bottomOffset: CGFloat = 0,
4345
onBackgroundTap: @escaping () -> Void,
4446
onActionExecuted: @escaping (MessageActionInfo) -> Void
@@ -51,6 +53,7 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
5153
self.channel = channel
5254
self.factory = factory
5355
self.currentSnapshot = currentSnapshot
56+
self.minOriginY = minOriginY
5457
self.bottomOffset = bottomOffset
5558
self.messageDisplayInfo = messageDisplayInfo
5659
self.onBackgroundTap = onBackgroundTap
@@ -280,10 +283,9 @@ public struct ReactionsOverlayView<Factory: ViewFactory>: View {
280283
let bottomPopupOffset =
281284
messageDisplayInfo.showsMessageActions ? messageActionsSize : userReactionsPopupHeight
282285
var originY = messageDisplayInfo.frame.origin.y
283-
let minOrigin: CGFloat = 100
284-
let maxOrigin: CGFloat = screenHeight - messageContainerHeight - bottomPopupOffset - minOrigin - bottomOffset
285-
if originY < minOrigin {
286-
originY = minOrigin
286+
let maxOrigin: CGFloat = screenHeight - messageContainerHeight - bottomPopupOffset - minOriginY - bottomOffset
287+
if originY < minOriginY {
288+
originY = minOriginY
287289
} else if originY > maxOrigin {
288290
originY = maxOrigin
289291
}

0 commit comments

Comments
 (0)