Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: theme for the message bubble and replies #2766

Merged
merged 3 commits into from
Nov 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions package/src/components/Message/MessageSimple/MessageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ const MessageContentWithContext = <

const {
theme: {
colors: { blue_alice, grey_gainsboro, grey_whisper, transparent, white },
colors: { blue_alice, grey_whisper, light_gray, transparent, white_snow },
messageSimple: {
content: {
container: {
Expand Down Expand Up @@ -214,20 +214,20 @@ const MessageContentWithContext = <

const isMessageReceivedOrErrorType = !isMyMessage || error;

let backgroundColor = senderMessageBackgroundColor || grey_gainsboro;
let backgroundColor = senderMessageBackgroundColor ?? light_gray;
if (onlyEmojis && !message.quoted_message) {
backgroundColor = transparent;
} else if (otherAttachments.length) {
if (otherAttachments[0].type === 'giphy') {
backgroundColor = message.quoted_message ? grey_gainsboro : transparent;
backgroundColor = message.quoted_message ? light_gray : transparent;
} else {
backgroundColor = blue_alice;
}
} else if (isMessageReceivedOrErrorType) {
backgroundColor = receiverMessageBackgroundColor || white;
backgroundColor = receiverMessageBackgroundColor ?? white_snow;
}

const repliesCurveColor = !isMessageReceivedOrErrorType ? backgroundColor : grey_gainsboro;
const repliesCurveColor = !isMessageReceivedOrErrorType ? backgroundColor : light_gray;

const getBorderRadius = () => {
// enum('top', 'middle', 'bottom', 'single')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const styles = StyleSheet.create({
},
messageRepliesCurve: {
borderTopWidth: 0,
borderWidth: 1,
borderWidth: 2,
height: 16,
width: 16,
},
Expand Down Expand Up @@ -181,13 +181,15 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
message: prevMessage,
noBorder: prevNoBorder,
onOpenThread: prevOnOpenThread,
repliesCurveColor: prevRepliesCurveColor,
t: prevT,
threadList: prevThreadList,
} = prevProps;
const {
message: nextMessage,
noBorder: nextNoBorder,
onOpenThread: nextOnOpenThread,
repliesCurveColor: nextRepliesCurveColor,
t: nextT,
threadList: nextThreadList,
} = nextProps;
Expand All @@ -201,6 +203,9 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
const noBorderEqual = prevNoBorder === nextNoBorder;
if (!noBorderEqual) return false;

const repliesCurveColorEqual = prevRepliesCurveColor === nextRepliesCurveColor;
if (!repliesCurveColorEqual) return false;

const tEqual = prevT === nextT;
if (!tEqual) return false;

Expand Down
6 changes: 3 additions & 3 deletions package/src/components/MessageOverlay/MessageOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ const MessageOverlayWithContext = <
);

const {
colors: { blue_alice, grey_gainsboro, grey_whisper, transparent },
colors: { blue_alice, grey_gainsboro, grey_whisper, light_gray, transparent, white_snow },
messageSimple: {
content: {
container: { borderRadiusL, borderRadiusS },
Expand Down Expand Up @@ -364,8 +364,8 @@ const MessageOverlayWithContext = <
: grey_gainsboro
: blue_alice
: alignment === 'left'
? receiverMessageBackgroundColor
: senderMessageBackgroundColor,
? receiverMessageBackgroundColor ?? white_snow
: senderMessageBackgroundColor ?? light_gray,
borderBottomLeftRadius:
(groupStyle === 'left_bottom' || groupStyle === 'left_single') &&
(!hasThreadReplies || threadList)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ exports[`Thread should match thread snapshot 1`] = `
"overflow": "hidden",
},
{
"backgroundColor": "#F2F2F2",
"backgroundColor": "#FCFCFC",
"borderBottomLeftRadius": 0,
"borderBottomRightRadius": 16,
"borderColor": "#ECEBEB",
Expand Down Expand Up @@ -742,7 +742,7 @@ exports[`Thread should match thread snapshot 1`] = `
"overflow": "hidden",
},
{
"backgroundColor": "#F2F2F2",
"backgroundColor": "#FCFCFC",
"borderBottomLeftRadius": 0,
"borderBottomRightRadius": 16,
"borderColor": "#ECEBEB",
Expand Down Expand Up @@ -1068,7 +1068,7 @@ exports[`Thread should match thread snapshot 1`] = `
"overflow": "hidden",
},
{
"backgroundColor": "#F2F2F2",
"backgroundColor": "#FCFCFC",
"borderBottomLeftRadius": 0,
"borderBottomRightRadius": 16,
"borderColor": "#ECEBEB",
Expand Down Expand Up @@ -1422,7 +1422,7 @@ exports[`Thread should match thread snapshot 1`] = `
"overflow": "hidden",
},
{
"backgroundColor": "#F2F2F2",
"backgroundColor": "#FCFCFC",
"borderBottomLeftRadius": 0,
"borderBottomRightRadius": 16,
"borderColor": "#ECEBEB",
Expand Down
2 changes: 0 additions & 2 deletions package/src/contexts/themeContext/utils/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1218,10 +1218,8 @@ export const defaultTheme: Theme = {
metaText: {
fontSize: 12,
},
receiverMessageBackgroundColor: Colors.white_smoke,
replyBorder: {},
replyContainer: {},
senderMessageBackgroundColor: Colors.grey_gainsboro,
textContainer: {
onlyEmojiMarkdown: { text: { fontSize: 50 } },
},
Expand Down
Loading