stream-chat-react-native-core 5.33.1-beta.3 → 5.33.1-beta.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/components/Attachment/Gallery.js +3 -2
- package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
- package/lib/commonjs/components/Channel/hooks/useCreateThreadContext.js +2 -1
- package/lib/commonjs/components/Channel/hooks/useCreateThreadContext.js.map +1 -1
- package/lib/commonjs/components/Thread/Thread.js +7 -1
- package/lib/commonjs/components/Thread/Thread.js.map +1 -1
- package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js +12 -6
- package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js.map +1 -1
- package/lib/commonjs/contexts/themeContext/utils/theme.js +1 -0
- package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/commonjs/contexts/threadContext/ThreadContext.js.map +1 -1
- package/lib/commonjs/version.json +1 -1
- package/lib/module/components/Attachment/Gallery.js +3 -2
- package/lib/module/components/Attachment/Gallery.js.map +1 -1
- package/lib/module/components/Channel/hooks/useCreateThreadContext.js +2 -1
- package/lib/module/components/Channel/hooks/useCreateThreadContext.js.map +1 -1
- package/lib/module/components/Thread/Thread.js +7 -1
- package/lib/module/components/Thread/Thread.js.map +1 -1
- package/lib/module/components/Thread/components/ThreadFooterComponent.js +12 -6
- package/lib/module/components/Thread/components/ThreadFooterComponent.js.map +1 -1
- package/lib/module/contexts/themeContext/utils/theme.js +1 -0
- package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
- package/lib/module/contexts/threadContext/ThreadContext.js.map +1 -1
- package/lib/module/version.json +1 -1
- package/lib/typescript/components/Channel/hooks/useCreateThreadContext.d.ts.map +1 -1
- package/lib/typescript/components/Thread/Thread.d.ts +1 -1
- package/lib/typescript/components/Thread/Thread.d.ts.map +1 -1
- package/lib/typescript/components/Thread/components/ThreadFooterComponent.d.ts +4 -1
- package/lib/typescript/components/Thread/components/ThreadFooterComponent.d.ts.map +1 -1
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts +6 -0
- package/lib/typescript/contexts/themeContext/utils/theme.d.ts.map +1 -1
- package/lib/typescript/contexts/threadContext/ThreadContext.d.ts +4 -0
- package/lib/typescript/contexts/threadContext/ThreadContext.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Attachment/Gallery.tsx +3 -3
- package/src/components/Channel/hooks/useCreateThreadContext.ts +2 -0
- package/src/components/Thread/Thread.tsx +5 -2
- package/src/components/Thread/components/ThreadFooterComponent.tsx +25 -7
- package/src/contexts/themeContext/utils/theme.ts +7 -0
- package/src/contexts/threadContext/ThreadContext.tsx +4 -0
- package/src/version.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ThreadContext.d.ts","sourceRoot":"","sources":["../../../../src/contexts/threadContext/ThreadContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAc,MAAM,OAAO,CAAC;AAE7D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAEhD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mDAAmD,CAAC;AACrF,OAAO,KAAK,EAAE,yBAAyB,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAMhF,MAAM,MAAM,kBAAkB,CAC5B,kBAAkB,SAAS,yBAAyB,GAAG,yBAAyB,IAC9E;IACF,4BAA4B,EAAE,OAAO,CAAC;IACtC,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,cAAc,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IACpC,UAAU,EAAE,CAAC,OAAO,EAAE,WAAW,CAAC,kBAAkB,CAAC,KAAK,IAAI,CAAC;IAC/D,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,oBAAoB,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,CAAC;IACpE,M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CACrC,CAAC;AAEF,eAAO,MAAM,aAAa,8DAAwE,CAAC;AAEnG,eAAO,MAAM,cAAc;;wBAW1B,CAAC;AAEF,eAAO,MAAM,gBAAgB,gIAc5B,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,iBAAiB,4NAe7B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "stream-chat-react-native-core",
|
|
3
3
|
"description": "The official React Native and Expo components for Stream Chat, a service for building chat applications",
|
|
4
|
-
"version": "5.33.1-beta.
|
|
4
|
+
"version": "5.33.1-beta.5",
|
|
5
5
|
"author": {
|
|
6
6
|
"company": "Stream.io Inc",
|
|
7
7
|
"name": "Stream.io Inc"
|
|
@@ -289,7 +289,7 @@ const GalleryThumbnail = <
|
|
|
289
289
|
theme: {
|
|
290
290
|
colors: { overlay },
|
|
291
291
|
messageSimple: {
|
|
292
|
-
gallery: { image, imageContainer, moreImagesContainer, moreImagesText },
|
|
292
|
+
gallery: { image, imageBorderRadius, imageContainer, moreImagesContainer, moreImagesText },
|
|
293
293
|
},
|
|
294
294
|
},
|
|
295
295
|
} = useTheme();
|
|
@@ -366,7 +366,7 @@ const GalleryThumbnail = <
|
|
|
366
366
|
{thumbnail.type === 'video' ? (
|
|
367
367
|
<VideoThumbnail
|
|
368
368
|
style={[
|
|
369
|
-
borderRadius,
|
|
369
|
+
imageBorderRadius ?? borderRadius,
|
|
370
370
|
{
|
|
371
371
|
height: thumbnail.height - 1,
|
|
372
372
|
width: thumbnail.width - 1,
|
|
@@ -378,7 +378,7 @@ const GalleryThumbnail = <
|
|
|
378
378
|
) : (
|
|
379
379
|
<View style={styles.imageContainerStyle}>
|
|
380
380
|
<GalleryImageThumbnail
|
|
381
|
-
borderRadius={borderRadius}
|
|
381
|
+
borderRadius={imageBorderRadius ?? borderRadius}
|
|
382
382
|
ImageLoadingFailedIndicator={ImageLoadingFailedIndicator}
|
|
383
383
|
ImageLoadingIndicator={ImageLoadingIndicator}
|
|
384
384
|
thumbnail={thumbnail}
|
|
@@ -20,6 +20,7 @@ export const useCreateThreadContext = <
|
|
|
20
20
|
}: ThreadContextValue<StreamChatGenerics>) => {
|
|
21
21
|
const threadId = thread?.id;
|
|
22
22
|
const threadReplyCount = thread?.reply_count;
|
|
23
|
+
const threadLatestReactions = thread?.latest_reactions;
|
|
23
24
|
const threadMessagesStr = reduceMessagesToString(threadMessages);
|
|
24
25
|
|
|
25
26
|
const threadContext: ThreadContextValue<StreamChatGenerics> = useMemo(
|
|
@@ -42,6 +43,7 @@ export const useCreateThreadContext = <
|
|
|
42
43
|
threadLoadingMore,
|
|
43
44
|
threadMessagesStr,
|
|
44
45
|
threadReplyCount,
|
|
46
|
+
threadLatestReactions,
|
|
45
47
|
],
|
|
46
48
|
);
|
|
47
49
|
|
|
@@ -23,7 +23,7 @@ type ThreadPropsWithContext<
|
|
|
23
23
|
Pick<MessagesContextValue<StreamChatGenerics>, 'MessageList'> &
|
|
24
24
|
Pick<
|
|
25
25
|
ThreadContextValue<StreamChatGenerics>,
|
|
26
|
-
'closeThread' | 'loadMoreThread' | 'reloadThread' | 'thread'
|
|
26
|
+
'closeThread' | 'loadMoreThread' | 'parentMessagePreventPress' | 'reloadThread' | 'thread'
|
|
27
27
|
> & {
|
|
28
28
|
/**
|
|
29
29
|
* Additional props for underlying MessageInput component.
|
|
@@ -68,6 +68,7 @@ const ThreadWithContext = <
|
|
|
68
68
|
MessageInput = DefaultMessageInput,
|
|
69
69
|
MessageList,
|
|
70
70
|
onThreadDismount,
|
|
71
|
+
parentMessagePreventPress = true,
|
|
71
72
|
thread,
|
|
72
73
|
} = props;
|
|
73
74
|
|
|
@@ -98,7 +99,9 @@ const ThreadWithContext = <
|
|
|
98
99
|
return (
|
|
99
100
|
<React.Fragment key={`thread-${thread.id}`}>
|
|
100
101
|
<MessageList
|
|
101
|
-
FooterComponent={
|
|
102
|
+
FooterComponent={() => (
|
|
103
|
+
<ThreadFooterComponent parentMessagePreventPress={parentMessagePreventPress} />
|
|
104
|
+
)}
|
|
102
105
|
threadList
|
|
103
106
|
{...additionalMessageListProps}
|
|
104
107
|
/>
|
|
@@ -38,14 +38,14 @@ const styles = StyleSheet.create({
|
|
|
38
38
|
type ThreadFooterComponentPropsWithContext<
|
|
39
39
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
40
40
|
> = Pick<MessagesContextValue<StreamChatGenerics>, 'Message'> &
|
|
41
|
-
Pick<ThreadContextValue<StreamChatGenerics>, 'thread'>;
|
|
41
|
+
Pick<ThreadContextValue<StreamChatGenerics>, 'parentMessagePreventPress' | 'thread'>;
|
|
42
42
|
|
|
43
43
|
const ThreadFooterComponentWithContext = <
|
|
44
44
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
45
45
|
>(
|
|
46
46
|
props: ThreadFooterComponentPropsWithContext<StreamChatGenerics>,
|
|
47
47
|
) => {
|
|
48
|
-
const { Message, thread } = props;
|
|
48
|
+
const { Message, parentMessagePreventPress, thread } = props;
|
|
49
49
|
const { t } = useTranslationContext();
|
|
50
50
|
const { vw } = useViewport();
|
|
51
51
|
|
|
@@ -71,7 +71,12 @@ const ThreadFooterComponentWithContext = <
|
|
|
71
71
|
return (
|
|
72
72
|
<View style={styles.threadHeaderContainer} testID='thread-footer-component'>
|
|
73
73
|
<View style={styles.messagePadding}>
|
|
74
|
-
<Message
|
|
74
|
+
<Message
|
|
75
|
+
groupStyles={['single']}
|
|
76
|
+
message={thread}
|
|
77
|
+
preventPress={parentMessagePreventPress}
|
|
78
|
+
threadList
|
|
79
|
+
/>
|
|
75
80
|
</View>
|
|
76
81
|
<View style={[styles.newThread, newThread]}>
|
|
77
82
|
<Svg height={threadHeight ?? 24} style={styles.absolute} width={vw(100)}>
|
|
@@ -114,8 +119,12 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
|
|
|
114
119
|
prevProps: ThreadFooterComponentPropsWithContext<StreamChatGenerics>,
|
|
115
120
|
nextProps: ThreadFooterComponentPropsWithContext<StreamChatGenerics>,
|
|
116
121
|
) => {
|
|
117
|
-
const { thread: prevThread } =
|
|
118
|
-
|
|
122
|
+
const { parentMessagePreventPress: prevParentMessagePreventPress, thread: prevThread } =
|
|
123
|
+
prevProps;
|
|
124
|
+
const { parentMessagePreventPress: nextParentMessagePreventPress, thread: nextThread } =
|
|
125
|
+
nextProps;
|
|
126
|
+
|
|
127
|
+
if (prevParentMessagePreventPress !== nextParentMessagePreventPress) return false;
|
|
119
128
|
|
|
120
129
|
const threadEqual =
|
|
121
130
|
prevThread?.id === nextThread?.id &&
|
|
@@ -143,18 +152,27 @@ const MemoizedThreadFooter = React.memo(
|
|
|
143
152
|
areEqual,
|
|
144
153
|
) as typeof ThreadFooterComponentWithContext;
|
|
145
154
|
|
|
155
|
+
export type ThreadFooterComponentProps<
|
|
156
|
+
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
157
|
+
> = Partial<Pick<MessagesContextValue<StreamChatGenerics>, 'Message'>> &
|
|
158
|
+
Partial<Pick<ThreadContextValue<StreamChatGenerics>, 'parentMessagePreventPress' | 'thread'>>;
|
|
159
|
+
|
|
146
160
|
export const ThreadFooterComponent = <
|
|
147
161
|
StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
|
|
148
|
-
>(
|
|
162
|
+
>(
|
|
163
|
+
props: ThreadFooterComponentProps<StreamChatGenerics>,
|
|
164
|
+
) => {
|
|
149
165
|
const { Message } = useMessagesContext<StreamChatGenerics>();
|
|
150
|
-
const { thread } = useThreadContext<StreamChatGenerics>();
|
|
166
|
+
const { parentMessagePreventPress, thread } = useThreadContext<StreamChatGenerics>();
|
|
151
167
|
|
|
152
168
|
return (
|
|
153
169
|
<MemoizedThreadFooter
|
|
154
170
|
{...{
|
|
155
171
|
Message,
|
|
172
|
+
parentMessagePreventPress,
|
|
156
173
|
thread,
|
|
157
174
|
}}
|
|
175
|
+
{...props}
|
|
158
176
|
/>
|
|
159
177
|
);
|
|
160
178
|
};
|
|
@@ -499,6 +499,12 @@ export type Theme = {
|
|
|
499
499
|
moreImagesContainer: ViewStyle;
|
|
500
500
|
moreImagesText: TextStyle;
|
|
501
501
|
thumbnail: ViewStyle;
|
|
502
|
+
imageBorderRadius?: {
|
|
503
|
+
borderBottomLeftRadius: number;
|
|
504
|
+
borderBottomRightRadius: number;
|
|
505
|
+
borderTopLeftRadius: number;
|
|
506
|
+
borderTopRightRadius: number;
|
|
507
|
+
};
|
|
502
508
|
};
|
|
503
509
|
giphy: {
|
|
504
510
|
buttonContainer: ViewStyle;
|
|
@@ -1079,6 +1085,7 @@ export const defaultTheme: Theme = {
|
|
|
1079
1085
|
gridHeight: 195,
|
|
1080
1086
|
gridWidth: 256,
|
|
1081
1087
|
image: {},
|
|
1088
|
+
imageBorderRadius: undefined,
|
|
1082
1089
|
imageContainer: {},
|
|
1083
1090
|
maxHeight: 300,
|
|
1084
1091
|
maxWidth: 256,
|
|
@@ -22,6 +22,10 @@ export type ThreadContextValue<
|
|
|
22
22
|
threadHasMore: boolean;
|
|
23
23
|
threadLoadingMore: boolean;
|
|
24
24
|
threadMessages: ChannelState<StreamChatGenerics>['threads'][string];
|
|
25
|
+
/**
|
|
26
|
+
* Boolean to enable/disable parent message press
|
|
27
|
+
*/
|
|
28
|
+
parentMessagePreventPress?: boolean;
|
|
25
29
|
};
|
|
26
30
|
|
|
27
31
|
export const ThreadContext = React.createContext(DEFAULT_BASE_CONTEXT_VALUE as ThreadContextValue);
|
package/src/version.json
CHANGED