Skip to content

Commit 481d599

Browse files
committed
chore: resolve conflicts
2 parents 856462b + 1f8b90d commit 481d599

File tree

15 files changed

+283
-242
lines changed

15 files changed

+283
-242
lines changed

examples/SampleApp/src/components/AttachmentPickerSelectionBar.tsx

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useState } from 'react';
1+
import React, { useMemo, useState } from 'react';
22
import { StyleSheet, View } from 'react-native';
33
import {
44
AttachmentTypePickerButton,
@@ -10,6 +10,7 @@ import {
1010
PollPickerButton,
1111
useAttachmentPickerContext,
1212
useStableCallback,
13+
useTheme,
1314
} from 'stream-chat-react-native';
1415
import { ShareLocationIcon } from '../icons/ShareLocationIcon';
1516
import { LiveLocationCreateModal } from './LocationSharing/CreateLocationModal';
@@ -19,6 +20,8 @@ export const CustomAttachmentPickerSelectionBar = () => {
1920
const { attachmentPickerStore } = useAttachmentPickerContext();
2021
const { selectedPicker } = useAttachmentPickerState();
2122

23+
const styles = useStyles();
24+
2225
const onRequestClose = () => {
2326
setModalVisible(false);
2427
};
@@ -47,11 +50,15 @@ export const CustomAttachmentPickerSelectionBar = () => {
4750
);
4851
};
4952

50-
const styles = StyleSheet.create({
51-
selectionBar: {
52-
flexDirection: 'row',
53-
alignItems: 'center',
54-
paddingHorizontal: 16,
55-
paddingBottom: 12,
56-
},
57-
});
53+
const useStyles = () => {
54+
const { theme: { semantics }} = useTheme();
55+
return useMemo(() => StyleSheet.create({
56+
selectionBar: {
57+
backgroundColor: semantics.composerBg,
58+
flexDirection: 'row',
59+
alignItems: 'center',
60+
paddingHorizontal: 16,
61+
paddingBottom: 12,
62+
},
63+
}), [semantics])
64+
}

examples/SampleApp/src/hooks/useStreamChatTheme.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,16 +61,6 @@ const getChatStyle = (colorScheme: ColorSchemeName): DeepPartial<Theme> => ({
6161
white_smoke: '#F2F2F2',
6262
white_snow: '#FCFCFC',
6363
},
64-
...(colorScheme === 'dark'
65-
? {
66-
messageSimple: {
67-
content: {
68-
receiverMessageBackgroundColor: '#2D2F2F',
69-
senderMessageBackgroundColor: '#101418',
70-
},
71-
},
72-
}
73-
: {}),
7464
});
7565

7666
export const useStreamChatTheme = () => {

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React, { useMemo, useState } from 'react';
1+
import React, { useMemo } from 'react';
22
import {
33
AnimatableNumericValue,
44
ColorValue,
@@ -117,7 +117,6 @@ export type MessageContentPropsWithContext = Pick<
117117
* Child of MessageSimple that displays a message's content
118118
*/
119119
const MessageContentWithContext = (props: MessageContentPropsWithContext) => {
120-
const [longPressFired, setLongPressFired] = useState(false);
121120
const {
122121
additionalPressableProps,
123122
Attachment,
@@ -238,7 +237,6 @@ const MessageContentWithContext = (props: MessageContentPropsWithContext) => {
238237
<Pressable
239238
disabled={preventPress}
240239
onLongPress={(event) => {
241-
setLongPressFired(true);
242240
if (onLongPress) {
243241
onLongPress({
244242
emitter: 'messageContent',
@@ -262,10 +260,9 @@ const MessageContentWithContext = (props: MessageContentPropsWithContext) => {
262260
});
263261
}
264262
}}
265-
style={({ pressed }) => [{ opacity: pressed && !longPressFired ? 0.5 : 1 }, container]}
263+
style={container}
266264
{...additionalPressableProps}
267265
onPressOut={(event) => {
268-
setLongPressFired(false);
269266
setNativeScrollability(true);
270267

271268
if (additionalPressableProps?.onPressOut) {
@@ -382,6 +379,7 @@ const areEqual = (
382379
nextProps: MessageContentPropsWithContext,
383380
) => {
384381
const {
382+
backgroundColor: prevBackgroundColor,
385383
preventPress: prevPreventPress,
386384
goToMessage: prevGoToMessage,
387385
groupStyles: prevGroupStyles,
@@ -393,6 +391,7 @@ const areEqual = (
393391
t: prevT,
394392
} = prevProps;
395393
const {
394+
backgroundColor: nextBackgroundColor,
396395
preventPress: nextPreventPress,
397396
goToMessage: nextGoToMessage,
398397
groupStyles: nextGroupStyles,
@@ -403,6 +402,10 @@ const areEqual = (
403402
t: nextT,
404403
} = nextProps;
405404

405+
if (prevBackgroundColor !== nextBackgroundColor) {
406+
return false;
407+
}
408+
406409
if (prevPreventPress !== nextPreventPress) {
407410
return false;
408411
}

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

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -120,16 +120,12 @@ const MessageSimpleWithContext = forwardRef<View, MessageSimplePropsWithContext>
120120

121121
const {
122122
theme: {
123-
colors: { blue_alice, grey_gainsboro, light_blue, light_gray, transparent },
123+
semantics,
124+
colors: { blue_alice, grey_gainsboro, transparent },
124125
messageSimple: {
125126
container,
126127
repliesContainer,
127-
content: {
128-
container: contentContainer,
129-
errorContainer,
130-
receiverMessageBackgroundColor,
131-
senderMessageBackgroundColor,
132-
},
128+
content: { container: contentContainer, errorContainer },
133129
lastMessageContainer,
134130
messageGroupedSingleOrBottomContainer,
135131
messageGroupedTopContainer,
@@ -166,7 +162,7 @@ const MessageSimpleWithContext = forwardRef<View, MessageSimplePropsWithContext>
166162
}
167163
}
168164

169-
let backgroundColor = senderMessageBackgroundColor ?? light_blue;
165+
let backgroundColor = semantics.chatBgOutgoing;
170166
if (onlyEmojis && !message.quoted_message) {
171167
backgroundColor = transparent;
172168
} else if (otherAttachments.length) {
@@ -176,7 +172,7 @@ const MessageSimpleWithContext = forwardRef<View, MessageSimplePropsWithContext>
176172
backgroundColor = blue_alice;
177173
}
178174
} else if (isMessageReceivedOrErrorType) {
179-
backgroundColor = receiverMessageBackgroundColor ?? light_gray;
175+
backgroundColor = semantics.chatBgIncoming;
180176
}
181177

182178
const onSwipeActionHandler = useStableCallback(() => {

package/src/components/Message/MessageSimple/__tests__/__snapshots__/MessageAvatar.test.js.snap

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ exports[`MessageAvatar should render message avatar 1`] = `
2222
"width": 32,
2323
},
2424
{
25-
"backgroundColor": "#d1f3f6",
25+
"backgroundColor": "#003a3f",
2626
},
2727
{
28-
"borderColor": "rgba(0, 0, 0, 0.1)",
28+
"borderColor": "rgba(255, 255, 255, 0.2)",
2929
"borderWidth": 1,
3030
},
3131
undefined,

package/src/components/Message/MessageSimple/utils/renderText.tsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,11 @@ const defaultMarkdownStyles: MarkdownStyle = {
126126
paragraph: {
127127
marginBottom: 8,
128128
fontSize: primitives.typographyFontSizeMd,
129-
lineHeight: primitives.typographyLineHeightNormal,
130129
marginTop: 8,
131130
},
132131
paragraphCenter: {
133132
marginBottom: 8,
134133
fontSize: primitives.typographyFontSizeMd,
135-
lineHeight: primitives.typographyLineHeightNormal,
136134
marginTop: 8,
137135
},
138136
paragraphWithImage: {
@@ -201,6 +199,16 @@ export const renderText = (params: RenderTextParams) => {
201199
const styles: MarkdownStyle = {
202200
...defaultMarkdownStyles,
203201
...markdownStyles,
202+
paragraph: {
203+
...(onlyEmojis ? {} : { lineHeight: primitives.typographyLineHeightNormal }),
204+
...defaultMarkdownStyles.paragraph,
205+
...markdownStyles?.paragraph,
206+
},
207+
paragraphCenter: {
208+
...(onlyEmojis ? {} : { lineHeight: primitives.typographyLineHeightNormal }),
209+
...defaultMarkdownStyles.paragraphCenter,
210+
...markdownStyles?.paragraphCenter,
211+
},
204212
autolink: {
205213
fontSize: primitives.typographyFontSizeMd,
206214
lineHeight: primitives.typographyLineHeightNormal,
@@ -279,7 +287,7 @@ export const renderText = (params: RenderTextParams) => {
279287
},
280288
text: {
281289
fontSize: primitives.typographyFontSizeMd,
282-
lineHeight: primitives.typographyLineHeightNormal,
290+
...(onlyEmojis ? {} : { lineHeight: primitives.typographyLineHeightNormal }),
283291
...defaultMarkdownStyles.text,
284292
color: colors.black,
285293
...markdownStyles?.text,

package/src/components/MessageInput/MessageInput.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,16 @@ const useStyles = () => {
7171
} = useTheme();
7272
return useMemo(() => {
7373
return StyleSheet.create({
74+
pollModalWrapper: {
75+
alignItems: 'center',
76+
flex: 1,
77+
justifyContent: 'center',
78+
backgroundColor: semantics.backgroundElevationElevation1,
79+
},
80+
pollSafeArea: {
81+
flex: 1,
82+
backgroundColor: semantics.backgroundElevationElevation1,
83+
},
7484
container: {
7585
alignItems: 'center',
7686
flexDirection: 'row',
@@ -454,14 +464,14 @@ const MessageInputWithContext = (props: MessageInputPropsWithContext) => {
454464
</Animated.View>
455465

456466
{showPollCreationDialog ? (
457-
<View style={{ alignItems: 'center', flex: 1, justifyContent: 'center' }}>
467+
<View style={styles.pollModalWrapper}>
458468
<Modal
459469
animationType='slide'
460470
onRequestClose={closePollCreationDialog}
461471
visible={showPollCreationDialog}
462472
>
463-
<GestureHandlerRootView style={{ flex: 1 }}>
464-
<SafeAreaViewWrapper style={{ flex: 1 }}>
473+
<GestureHandlerRootView style={styles.pollSafeArea}>
474+
<SafeAreaViewWrapper style={styles.pollSafeArea}>
465475
<CreatePoll
466476
closePollCreationDialog={closePollCreationDialog}
467477
CreatePollContent={CreatePollContent}

0 commit comments

Comments
 (0)