Skip to content

Commit 980c383

Browse files
authored
fix: theme for the message bubble and replies (#2766)
* fix: theme for the message bubble and replies * fix: theme for the message bubble and replies * fix: add null coleasing operator
1 parent a932d07 commit 980c383

File tree

5 files changed

+18
-15
lines changed

5 files changed

+18
-15
lines changed

package/src/components/Message/MessageSimple/MessageContent.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ const MessageContentWithContext = <
149149

150150
const {
151151
theme: {
152-
colors: { blue_alice, grey_gainsboro, grey_whisper, transparent, white },
152+
colors: { blue_alice, grey_whisper, light_gray, transparent, white_snow },
153153
messageSimple: {
154154
content: {
155155
container: {
@@ -214,20 +214,20 @@ const MessageContentWithContext = <
214214

215215
const isMessageReceivedOrErrorType = !isMyMessage || error;
216216

217-
let backgroundColor = senderMessageBackgroundColor || grey_gainsboro;
217+
let backgroundColor = senderMessageBackgroundColor ?? light_gray;
218218
if (onlyEmojis && !message.quoted_message) {
219219
backgroundColor = transparent;
220220
} else if (otherAttachments.length) {
221221
if (otherAttachments[0].type === 'giphy') {
222-
backgroundColor = message.quoted_message ? grey_gainsboro : transparent;
222+
backgroundColor = message.quoted_message ? light_gray : transparent;
223223
} else {
224224
backgroundColor = blue_alice;
225225
}
226226
} else if (isMessageReceivedOrErrorType) {
227-
backgroundColor = receiverMessageBackgroundColor || white;
227+
backgroundColor = receiverMessageBackgroundColor ?? white_snow;
228228
}
229229

230-
const repliesCurveColor = !isMessageReceivedOrErrorType ? backgroundColor : grey_gainsboro;
230+
const repliesCurveColor = !isMessageReceivedOrErrorType ? backgroundColor : light_gray;
231231

232232
const getBorderRadius = () => {
233233
// enum('top', 'middle', 'bottom', 'single')

package/src/components/Message/MessageSimple/MessageReplies.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const styles = StyleSheet.create({
3232
},
3333
messageRepliesCurve: {
3434
borderTopWidth: 0,
35-
borderWidth: 1,
35+
borderWidth: 2,
3636
height: 16,
3737
width: 16,
3838
},
@@ -181,13 +181,15 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
181181
message: prevMessage,
182182
noBorder: prevNoBorder,
183183
onOpenThread: prevOnOpenThread,
184+
repliesCurveColor: prevRepliesCurveColor,
184185
t: prevT,
185186
threadList: prevThreadList,
186187
} = prevProps;
187188
const {
188189
message: nextMessage,
189190
noBorder: nextNoBorder,
190191
onOpenThread: nextOnOpenThread,
192+
repliesCurveColor: nextRepliesCurveColor,
191193
t: nextT,
192194
threadList: nextThreadList,
193195
} = nextProps;
@@ -201,6 +203,9 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
201203
const noBorderEqual = prevNoBorder === nextNoBorder;
202204
if (!noBorderEqual) return false;
203205

206+
const repliesCurveColorEqual = prevRepliesCurveColor === nextRepliesCurveColor;
207+
if (!repliesCurveColorEqual) return false;
208+
204209
const tEqual = prevT === nextT;
205210
if (!tEqual) return false;
206211

package/src/components/MessageOverlay/MessageOverlay.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ const MessageOverlayWithContext = <
170170
);
171171

172172
const {
173-
colors: { blue_alice, grey_gainsboro, grey_whisper, transparent },
173+
colors: { blue_alice, grey_gainsboro, grey_whisper, light_gray, transparent, white_snow },
174174
messageSimple: {
175175
content: {
176176
container: { borderRadiusL, borderRadiusS },
@@ -364,8 +364,8 @@ const MessageOverlayWithContext = <
364364
: grey_gainsboro
365365
: blue_alice
366366
: alignment === 'left'
367-
? receiverMessageBackgroundColor
368-
: senderMessageBackgroundColor,
367+
? receiverMessageBackgroundColor ?? white_snow
368+
: senderMessageBackgroundColor ?? light_gray,
369369
borderBottomLeftRadius:
370370
(groupStyle === 'left_bottom' || groupStyle === 'left_single') &&
371371
(!hasThreadReplies || threadList)

package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -416,7 +416,7 @@ exports[`Thread should match thread snapshot 1`] = `
416416
"overflow": "hidden",
417417
},
418418
{
419-
"backgroundColor": "#F2F2F2",
419+
"backgroundColor": "#FCFCFC",
420420
"borderBottomLeftRadius": 0,
421421
"borderBottomRightRadius": 16,
422422
"borderColor": "#ECEBEB",
@@ -742,7 +742,7 @@ exports[`Thread should match thread snapshot 1`] = `
742742
"overflow": "hidden",
743743
},
744744
{
745-
"backgroundColor": "#F2F2F2",
745+
"backgroundColor": "#FCFCFC",
746746
"borderBottomLeftRadius": 0,
747747
"borderBottomRightRadius": 16,
748748
"borderColor": "#ECEBEB",
@@ -1068,7 +1068,7 @@ exports[`Thread should match thread snapshot 1`] = `
10681068
"overflow": "hidden",
10691069
},
10701070
{
1071-
"backgroundColor": "#F2F2F2",
1071+
"backgroundColor": "#FCFCFC",
10721072
"borderBottomLeftRadius": 0,
10731073
"borderBottomRightRadius": 16,
10741074
"borderColor": "#ECEBEB",
@@ -1422,7 +1422,7 @@ exports[`Thread should match thread snapshot 1`] = `
14221422
"overflow": "hidden",
14231423
},
14241424
{
1425-
"backgroundColor": "#F2F2F2",
1425+
"backgroundColor": "#FCFCFC",
14261426
"borderBottomLeftRadius": 0,
14271427
"borderBottomRightRadius": 16,
14281428
"borderColor": "#ECEBEB",

package/src/contexts/themeContext/utils/theme.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1218,10 +1218,8 @@ export const defaultTheme: Theme = {
12181218
metaText: {
12191219
fontSize: 12,
12201220
},
1221-
receiverMessageBackgroundColor: Colors.white_smoke,
12221221
replyBorder: {},
12231222
replyContainer: {},
1224-
senderMessageBackgroundColor: Colors.grey_gainsboro,
12251223
textContainer: {
12261224
onlyEmojiMarkdown: { text: { fontSize: 50 } },
12271225
},

0 commit comments

Comments
 (0)