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.
Files changed (46) hide show
  1. package/lib/commonjs/components/Channel/hooks/useCreateThreadContext.js +2 -1
  2. package/lib/commonjs/components/Channel/hooks/useCreateThreadContext.js.map +1 -1
  3. package/lib/commonjs/components/ChannelPreview/ChannelPreview.js +1 -1
  4. package/lib/commonjs/components/ChannelPreview/ChannelPreview.js.map +1 -1
  5. package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js +4 -5
  6. package/lib/commonjs/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
  7. package/lib/commonjs/components/Thread/Thread.js +7 -1
  8. package/lib/commonjs/components/Thread/Thread.js.map +1 -1
  9. package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js +12 -6
  10. package/lib/commonjs/components/Thread/components/ThreadFooterComponent.js.map +1 -1
  11. package/lib/commonjs/contexts/threadContext/ThreadContext.js.map +1 -1
  12. package/lib/commonjs/utils/utils.js.map +1 -1
  13. package/lib/commonjs/version.json +1 -1
  14. package/lib/module/components/Channel/hooks/useCreateThreadContext.js +2 -1
  15. package/lib/module/components/Channel/hooks/useCreateThreadContext.js.map +1 -1
  16. package/lib/module/components/ChannelPreview/ChannelPreview.js +1 -1
  17. package/lib/module/components/ChannelPreview/ChannelPreview.js.map +1 -1
  18. package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js +4 -5
  19. package/lib/module/components/ChannelPreview/hooks/useLatestMessagePreview.js.map +1 -1
  20. package/lib/module/components/Thread/Thread.js +7 -1
  21. package/lib/module/components/Thread/Thread.js.map +1 -1
  22. package/lib/module/components/Thread/components/ThreadFooterComponent.js +12 -6
  23. package/lib/module/components/Thread/components/ThreadFooterComponent.js.map +1 -1
  24. package/lib/module/contexts/threadContext/ThreadContext.js.map +1 -1
  25. package/lib/module/utils/utils.js.map +1 -1
  26. package/lib/module/version.json +1 -1
  27. package/lib/typescript/components/Channel/hooks/useCreateThreadContext.d.ts.map +1 -1
  28. package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts +1 -1
  29. package/lib/typescript/components/ChannelPreview/hooks/useLatestMessagePreview.d.ts.map +1 -1
  30. package/lib/typescript/components/Thread/Thread.d.ts +1 -1
  31. package/lib/typescript/components/Thread/Thread.d.ts.map +1 -1
  32. package/lib/typescript/components/Thread/components/ThreadFooterComponent.d.ts +4 -1
  33. package/lib/typescript/components/Thread/components/ThreadFooterComponent.d.ts.map +1 -1
  34. package/lib/typescript/contexts/threadContext/ThreadContext.d.ts +4 -0
  35. package/lib/typescript/contexts/threadContext/ThreadContext.d.ts.map +1 -1
  36. package/lib/typescript/utils/utils.d.ts +2 -2
  37. package/lib/typescript/utils/utils.d.ts.map +1 -1
  38. package/package.json +1 -1
  39. package/src/components/Channel/hooks/useCreateThreadContext.ts +2 -0
  40. package/src/components/ChannelPreview/ChannelPreview.tsx +1 -1
  41. package/src/components/ChannelPreview/hooks/useLatestMessagePreview.ts +8 -5
  42. package/src/components/Thread/Thread.tsx +5 -2
  43. package/src/components/Thread/components/ThreadFooterComponent.tsx +25 -7
  44. package/src/contexts/threadContext/ThreadContext.tsx +4 -0
  45. package/src/utils/utils.ts +5 -1
  46. 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 groupStyles={['single']} message={thread} preventPress threadList />
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 } = prevProps;
118
- const { thread: nextThread } = nextProps;
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);
@@ -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
- }: FormatMessageResponse<StreamChatGenerics> | MessageType<StreamChatGenerics>): string =>
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
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "5.33.1-beta.4"
2
+ "version": "5.33.1-beta.6"
3
3
  }