File tree Expand file tree Collapse file tree 2 files changed +12
-0
lines changed
Sources/StreamChatSwiftUI Expand file tree Collapse file tree 2 files changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -118,6 +118,7 @@ struct ReactionsAnimatableView: View {
118
118
. foregroundColor ( color ( for: reaction) )
119
119
. frame ( width: useLargeIcons ? 25 : 20 , height: useLargeIcons ? 27 : 20 )
120
120
}
121
+ . background ( reactionSelectedBackgroundColor ( for: reaction) . cornerRadius ( 8 ) )
121
122
. scaleEffect ( index ( for: reaction) != nil ? animationStates [ index ( for: reaction) !] : 1 )
122
123
. onAppear {
123
124
guard let index = index ( for: reaction) else {
@@ -142,6 +143,16 @@ struct ReactionsAnimatableView: View {
142
143
. reactionsBubble ( for: message, background: colors. background8)
143
144
}
144
145
146
+ private func reactionSelectedBackgroundColor( for reaction: MessageReactionType ) -> Color ? {
147
+ var colors = colors
148
+ guard let color = colors. selectedReactionBackgroundColor else {
149
+ return nil
150
+ }
151
+
152
+ let backgroundColor : Color ? = userReactionIDs. contains ( reaction) ? Color ( color) : nil
153
+ return backgroundColor
154
+ }
155
+
145
156
private func index( for reaction: MessageReactionType ) -> Int ? {
146
157
let index = reactions. firstIndex ( where: { type in
147
158
type == reaction
Original file line number Diff line number Diff line change @@ -76,6 +76,7 @@ public struct ColorPalette {
76
76
public lazy var quotedMessageBackgroundOtherUser : UIColor = background8
77
77
public lazy var reactionCurrentUserColor : UIColor ? = UIColor ( tintColor)
78
78
public lazy var reactionOtherUserColor : UIColor ? = textLowEmphasis
79
+ public lazy var selectedReactionBackgroundColor : UIColor ? = nil
79
80
}
80
81
81
82
// Those colors are default defined stream constants, which are fallback values if you don't implement your color theme.
You can’t perform that action at this time.
0 commit comments