stream-chat-react-native-core 5.1.0 → 5.2.0

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 (72) hide show
  1. package/lib/commonjs/components/ChannelList/ChannelListMessenger.js +32 -15
  2. package/lib/commonjs/components/ChannelList/ChannelListMessenger.js.map +1 -1
  3. package/lib/commonjs/components/Chat/Chat.js +17 -5
  4. package/lib/commonjs/components/Chat/Chat.js.map +1 -1
  5. package/lib/commonjs/components/ImageGallery/ImageGallery.js +106 -100
  6. package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
  7. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +14 -16
  8. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
  9. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +13 -16
  10. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  11. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +6 -6
  12. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  13. package/lib/commonjs/components/MessageList/MessageList.js +39 -26
  14. package/lib/commonjs/components/MessageList/MessageList.js.map +1 -1
  15. package/lib/commonjs/components/MessageOverlay/OverlayReactions.js +19 -19
  16. package/lib/commonjs/components/MessageOverlay/OverlayReactions.js.map +1 -1
  17. package/lib/commonjs/components/ProgressControl/ProgressControl.js +6 -6
  18. package/lib/commonjs/components/ProgressControl/ProgressControl.js.map +1 -1
  19. package/lib/commonjs/contexts/debugContext/DebugContext.js +63 -0
  20. package/lib/commonjs/contexts/debugContext/DebugContext.js.map +1 -0
  21. package/lib/commonjs/contexts/index.js +13 -0
  22. package/lib/commonjs/contexts/index.js.map +1 -1
  23. package/lib/commonjs/native.js.map +1 -1
  24. package/lib/commonjs/version.json +1 -1
  25. package/lib/module/components/ChannelList/ChannelListMessenger.js +32 -15
  26. package/lib/module/components/ChannelList/ChannelListMessenger.js.map +1 -1
  27. package/lib/module/components/Chat/Chat.js +17 -5
  28. package/lib/module/components/Chat/Chat.js.map +1 -1
  29. package/lib/module/components/ImageGallery/ImageGallery.js +106 -100
  30. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  31. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +14 -16
  32. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
  33. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +13 -16
  34. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  35. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +6 -6
  36. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  37. package/lib/module/components/MessageList/MessageList.js +39 -26
  38. package/lib/module/components/MessageList/MessageList.js.map +1 -1
  39. package/lib/module/components/MessageOverlay/OverlayReactions.js +19 -19
  40. package/lib/module/components/MessageOverlay/OverlayReactions.js.map +1 -1
  41. package/lib/module/components/ProgressControl/ProgressControl.js +6 -6
  42. package/lib/module/components/ProgressControl/ProgressControl.js.map +1 -1
  43. package/lib/module/contexts/debugContext/DebugContext.js +63 -0
  44. package/lib/module/contexts/debugContext/DebugContext.js.map +1 -0
  45. package/lib/module/contexts/index.js +13 -0
  46. package/lib/module/contexts/index.js.map +1 -1
  47. package/lib/module/native.js.map +1 -1
  48. package/lib/module/version.json +1 -1
  49. package/lib/typescript/components/ImageGallery/ImageGallery.d.ts +3 -0
  50. package/lib/typescript/components/ImageGallery/components/AnimatedGalleryVideo.d.ts +5 -3
  51. package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts +1 -3
  52. package/lib/typescript/components/MessageOverlay/OverlayReactions.d.ts +1 -0
  53. package/lib/typescript/components/ProgressControl/ProgressControl.d.ts +1 -1
  54. package/lib/typescript/contexts/debugContext/DebugContext.d.ts +27 -0
  55. package/lib/typescript/contexts/index.d.ts +1 -0
  56. package/lib/typescript/native.d.ts +3 -2
  57. package/package.json +2 -2
  58. package/src/components/ChannelList/ChannelListMessenger.tsx +17 -0
  59. package/src/components/Chat/Chat.tsx +13 -0
  60. package/src/components/ImageGallery/ImageGallery.tsx +87 -65
  61. package/src/components/ImageGallery/__tests__/AnimatedVideoGallery.test.tsx +2 -2
  62. package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +40 -28
  63. package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +16 -9
  64. package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +1 -6
  65. package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +5 -6
  66. package/src/components/MessageList/MessageList.tsx +15 -0
  67. package/src/components/MessageOverlay/OverlayReactions.tsx +1 -0
  68. package/src/components/ProgressControl/ProgressControl.tsx +8 -4
  69. package/src/contexts/debugContext/DebugContext.tsx +77 -0
  70. package/src/contexts/index.ts +1 -0
  71. package/src/native.ts +3 -2
  72. package/src/version.json +1 -1
@@ -0,0 +1,77 @@
1
+ import React, { PropsWithChildren, useContext, useRef } from 'react';
2
+
3
+ import type { Channel, ChannelState, StreamChat } from 'stream-chat';
4
+
5
+ import type { MessageType } from '../../components/MessageList/hooks/useMessageList';
6
+ import type { DefaultStreamChatGenerics } from '../../types/types';
7
+
8
+ import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';
9
+
10
+ export type DebugDataType<
11
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
12
+ > =
13
+ | StreamChat<StreamChatGenerics>['user']
14
+ | {
15
+ data: Channel<StreamChatGenerics>['data'];
16
+ members: ChannelState<StreamChatGenerics>['members'];
17
+ }[]
18
+ | MessageType<StreamChatGenerics>[];
19
+
20
+ export type DebugContextValue<
21
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
22
+ > = {
23
+ eventType?: string;
24
+ sendEventParams?: {
25
+ action: string;
26
+ data: DebugDataType<StreamChatGenerics>;
27
+ };
28
+ setEventType?: (data: string) => void;
29
+ setSendEventParams?: (data: { action: string; data: DebugDataType<StreamChatGenerics> }) => void;
30
+ };
31
+
32
+ export const DebugContext = React.createContext(
33
+ DEFAULT_BASE_CONTEXT_VALUE as React.MutableRefObject<DebugContextValue>,
34
+ );
35
+
36
+ export const DebugContextProvider = <
37
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
38
+ >({
39
+ children,
40
+ useFlipper,
41
+ }: PropsWithChildren<{
42
+ useFlipper: () => {
43
+ updateData: (ref: React.RefObject<DebugContextValue<StreamChatGenerics>>) => void;
44
+ };
45
+ }>) => {
46
+ const debugRef = useRef<DebugContextValue<StreamChatGenerics>>({
47
+ eventType: undefined,
48
+ sendEventParams: undefined,
49
+ });
50
+
51
+ const { updateData } = useFlipper();
52
+
53
+ const ref = useRef<DebugContextValue<StreamChatGenerics>>({
54
+ setEventType: (data: string) => {
55
+ debugRef.current.eventType = data;
56
+ updateData(debugRef);
57
+ },
58
+ setSendEventParams: (data: { action: string; data: DebugDataType<StreamChatGenerics> }) => {
59
+ debugRef.current.sendEventParams = data;
60
+ updateData(debugRef);
61
+ },
62
+ });
63
+
64
+ return (
65
+ <DebugContext.Provider value={ref as unknown as React.MutableRefObject<DebugContextValue>}>
66
+ {children}
67
+ </DebugContext.Provider>
68
+ );
69
+ };
70
+
71
+ export const useDebugContext = () => {
72
+ const contextValue = useContext(
73
+ DebugContext,
74
+ ) as unknown as React.MutableRefObject<DebugContextValue>;
75
+
76
+ return contextValue;
77
+ };
@@ -2,6 +2,7 @@ export * from './attachmentPickerContext/AttachmentPickerContext';
2
2
  export * from './channelContext/ChannelContext';
3
3
  export * from './channelsContext/ChannelsContext';
4
4
  export * from './chatContext/ChatContext';
5
+ export * from './debugContext/DebugContext';
5
6
  export * from './imageGalleryContext/ImageGalleryContext';
6
7
  export * from './keyboardContext/KeyboardContext';
7
8
  export * from './messageContext/MessageContext';
package/src/native.ts CHANGED
@@ -164,9 +164,9 @@ export type SoundType = {
164
164
  export let Sound: SoundType;
165
165
 
166
166
  export type VideoProgressData = {
167
- currentTime?: number;
167
+ currentTime: number;
168
+ seekableDuration: number;
168
169
  playableDuration?: number;
169
- seekableDuration?: number;
170
170
  };
171
171
 
172
172
  export type VideoPayloadData = {
@@ -196,6 +196,7 @@ export type VideoType = {
196
196
  onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void;
197
197
  onProgress?: (data: VideoProgressData) => void;
198
198
  onReadyForDisplay?: () => void;
199
+ repeat?: boolean;
199
200
  replayAsync?: () => void;
200
201
  resizeMode?: string;
201
202
  seek?: (progress: number) => void;
package/src/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "5.1.0"
2
+ "version": "5.2.0"
3
3
  }