stream-chat-react-native-core 5.33.1-beta.4 → 5.33.1-beta.6
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/Channel/hooks/useCreateThreadContext.js +2 -1
- package/lib/commonjs/components/Channel/hooks/useCreateThreadContext.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreview.js +1 -1
- package/lib/commonjs/components/ChannelPreview/ChannelPreview.js.map +1 -1
- package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js +4 -5
- package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.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/threadContext/ThreadContext.js.map +1 -1
- package/lib/commonjs/utils/utils.js.map +1 -1
- package/lib/commonjs/version.json +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/ChannelPreview/ChannelPreview.js +1 -1
- package/lib/module/components/ChannelPreview/ChannelPreview.js.map +1 -1
- package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js +4 -5
- package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.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/threadContext/ThreadContext.js.map +1 -1
- package/lib/module/utils/utils.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/ChannelPreview/hooks/useLatestMessagePreview.d.ts +1 -1
- package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.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/threadContext/ThreadContext.d.ts +4 -0
- package/lib/typescript/contexts/threadContext/ThreadContext.d.ts.map +1 -1
- package/lib/typescript/utils/utils.d.ts +2 -2
- package/lib/typescript/utils/utils.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Channel/hooks/useCreateThreadContext.ts +2 -0
- package/src/components/ChannelPreview/ChannelPreview.tsx +1 -1
- package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts +8 -5
- package/src/components/Thread/Thread.tsx +5 -2
- package/src/components/Thread/components/ThreadFooterComponent.tsx +25 -7
- package/src/contexts/threadContext/ThreadContext.tsx +4 -0
- package/src/utils/utils.ts +5 -1
- package/src/version.json +1 -1
|
@@ -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
|
};
|
|
@@ -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/utils/utils.ts
CHANGED
|
@@ -9,6 +9,7 @@ import type {
|
|
|
9
9
|
ChannelMemberResponse,
|
|
10
10
|
CommandResponse,
|
|
11
11
|
FormatMessageResponse,
|
|
12
|
+
MessageResponse,
|
|
12
13
|
StreamChat,
|
|
13
14
|
UserResponse,
|
|
14
15
|
} from 'stream-chat';
|
|
@@ -614,7 +615,10 @@ export const stringifyMessage = <
|
|
|
614
615
|
text,
|
|
615
616
|
type,
|
|
616
617
|
updated_at,
|
|
617
|
-
}:
|
|
618
|
+
}:
|
|
619
|
+
| MessageResponse<StreamChatGenerics>
|
|
620
|
+
| FormatMessageResponse<StreamChatGenerics>
|
|
621
|
+
| MessageType<StreamChatGenerics>): string =>
|
|
618
622
|
`${
|
|
619
623
|
latest_reactions ? latest_reactions.map(({ type, user }) => `${type}${user?.id}`).join() : ''
|
|
620
624
|
}${
|
package/src/version.json
CHANGED