stream-chat-react-native-core 4.6.1 → 4.7.0-beta.3

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 (222) hide show
  1. package/lib/commonjs/components/Attachment/Attachment.js +22 -13
  2. package/lib/commonjs/components/Attachment/Attachment.js.map +1 -1
  3. package/lib/commonjs/components/Attachment/Card.js +23 -14
  4. package/lib/commonjs/components/Attachment/Card.js.map +1 -1
  5. package/lib/commonjs/components/Attachment/Gallery.js +72 -37
  6. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  7. package/lib/commonjs/components/Attachment/VideoThumbnail.js +83 -0
  8. package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -0
  9. package/lib/commonjs/components/Attachment/hooks/useGoToURL.js +1 -1
  10. package/lib/commonjs/components/Attachment/hooks/useGoToURL.js.map +1 -1
  11. package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js +1 -0
  12. package/lib/commonjs/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
  13. package/lib/commonjs/components/Attachment/utils/getAspectRatio.js +5 -5
  14. package/lib/commonjs/components/Attachment/utils/getAspectRatio.js.map +1 -1
  15. package/lib/commonjs/components/Channel/Channel.js +19 -14
  16. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  17. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js +4 -2
  18. package/lib/commonjs/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  19. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +43 -28
  20. package/lib/commonjs/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
  21. package/lib/commonjs/components/Chat/hooks/useIsOnline.js +6 -6
  22. package/lib/commonjs/components/Chat/hooks/useIsOnline.js.map +1 -1
  23. package/lib/commonjs/components/ImageGallery/ImageGallery.js +167 -345
  24. package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
  25. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js +4 -4
  26. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
  27. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +225 -0
  28. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -0
  29. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +102 -40
  30. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  31. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +145 -0
  32. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -0
  33. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +31 -34
  34. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
  35. package/lib/commonjs/components/ImageGallery/components/ProgressControl.js +153 -0
  36. package/lib/commonjs/components/ImageGallery/components/ProgressControl.js.map +1 -0
  37. package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js +373 -0
  38. package/lib/commonjs/components/ImageGallery/hooks/useImageGalleryGestures.js.map +1 -0
  39. package/lib/commonjs/components/Message/Message.js +23 -13
  40. package/lib/commonjs/components/Message/Message.js.map +1 -1
  41. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js +22 -15
  42. package/lib/commonjs/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  43. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +4 -2
  44. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  45. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js +25 -23
  46. package/lib/commonjs/components/MessageOverlay/MessageOverlay.js.map +1 -1
  47. package/lib/commonjs/components/Reply/Reply.js +32 -12
  48. package/lib/commonjs/components/Reply/Reply.js.map +1 -1
  49. package/lib/commonjs/components/Spinner/Spinner.js +12 -4
  50. package/lib/commonjs/components/Spinner/Spinner.js.map +1 -1
  51. package/lib/commonjs/components/index.js +26 -0
  52. package/lib/commonjs/components/index.js.map +1 -1
  53. package/lib/commonjs/contexts/messageContext/MessageContext.js +2 -2
  54. package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
  55. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +15 -4
  56. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  57. package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
  58. package/lib/commonjs/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  59. package/lib/commonjs/contexts/messagesContext/MessagesContext.js +2 -2
  60. package/lib/commonjs/contexts/messagesContext/MessagesContext.js.map +1 -1
  61. package/lib/commonjs/contexts/themeContext/utils/theme.js +10 -1
  62. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  63. package/lib/commonjs/icons/Pause.js +61 -0
  64. package/lib/commonjs/icons/Pause.js.map +1 -0
  65. package/lib/commonjs/icons/Play.js +42 -0
  66. package/lib/commonjs/icons/Play.js.map +1 -0
  67. package/lib/commonjs/icons/index.js +26 -0
  68. package/lib/commonjs/icons/index.js.map +1 -1
  69. package/lib/commonjs/mock-builders/api/queryMembers.js +98 -1
  70. package/lib/commonjs/mock-builders/api/queryMembers.js.map +1 -1
  71. package/lib/commonjs/native.js +7 -1
  72. package/lib/commonjs/native.js.map +1 -1
  73. package/lib/commonjs/utils/getUrlOfImageAttachment.js +1 -1
  74. package/lib/commonjs/utils/getUrlOfImageAttachment.js.map +1 -1
  75. package/lib/commonjs/version.json +1 -1
  76. package/lib/module/components/Attachment/Attachment.js +22 -13
  77. package/lib/module/components/Attachment/Attachment.js.map +1 -1
  78. package/lib/module/components/Attachment/Card.js +23 -14
  79. package/lib/module/components/Attachment/Card.js.map +1 -1
  80. package/lib/module/components/Attachment/Gallery.js +72 -37
  81. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  82. package/lib/module/components/Attachment/VideoThumbnail.js +83 -0
  83. package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -0
  84. package/lib/module/components/Attachment/hooks/useGoToURL.js +1 -1
  85. package/lib/module/components/Attachment/hooks/useGoToURL.js.map +1 -1
  86. package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js +1 -0
  87. package/lib/module/components/Attachment/utils/buildGallery/buildThumbnail.js.map +1 -1
  88. package/lib/module/components/Attachment/utils/getAspectRatio.js +5 -5
  89. package/lib/module/components/Attachment/utils/getAspectRatio.js.map +1 -1
  90. package/lib/module/components/Channel/Channel.js +19 -14
  91. package/lib/module/components/Channel/Channel.js.map +1 -1
  92. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js +4 -2
  93. package/lib/module/components/Channel/hooks/useCreateMessagesContext.js.map +1 -1
  94. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js +43 -28
  95. package/lib/module/components/ChannelPreview/hooks/useChannelPreviewDisplayName.js.map +1 -1
  96. package/lib/module/components/Chat/hooks/useIsOnline.js +6 -6
  97. package/lib/module/components/Chat/hooks/useIsOnline.js.map +1 -1
  98. package/lib/module/components/ImageGallery/ImageGallery.js +167 -345
  99. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  100. package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js +4 -4
  101. package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
  102. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +225 -0
  103. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -0
  104. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +102 -40
  105. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  106. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +145 -0
  107. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -0
  108. package/lib/module/components/ImageGallery/components/ImageGrid.js +31 -34
  109. package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
  110. package/lib/module/components/ImageGallery/components/ProgressControl.js +153 -0
  111. package/lib/module/components/ImageGallery/components/ProgressControl.js.map +1 -0
  112. package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js +373 -0
  113. package/lib/module/components/ImageGallery/hooks/useImageGalleryGestures.js.map +1 -0
  114. package/lib/module/components/Message/Message.js +23 -13
  115. package/lib/module/components/Message/Message.js.map +1 -1
  116. package/lib/module/components/Message/MessageSimple/utils/renderText.js +22 -15
  117. package/lib/module/components/Message/MessageSimple/utils/renderText.js.map +1 -1
  118. package/lib/module/components/Message/hooks/useCreateMessageContext.js +4 -2
  119. package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  120. package/lib/module/components/MessageOverlay/MessageOverlay.js +25 -23
  121. package/lib/module/components/MessageOverlay/MessageOverlay.js.map +1 -1
  122. package/lib/module/components/Reply/Reply.js +32 -12
  123. package/lib/module/components/Reply/Reply.js.map +1 -1
  124. package/lib/module/components/Spinner/Spinner.js +12 -4
  125. package/lib/module/components/Spinner/Spinner.js.map +1 -1
  126. package/lib/module/components/index.js +26 -0
  127. package/lib/module/components/index.js.map +1 -1
  128. package/lib/module/contexts/messageContext/MessageContext.js +2 -2
  129. package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
  130. package/lib/module/contexts/messageInputContext/MessageInputContext.js +15 -4
  131. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  132. package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js +2 -2
  133. package/lib/module/contexts/messageOverlayContext/MessageOverlayContext.js.map +1 -1
  134. package/lib/module/contexts/messagesContext/MessagesContext.js +2 -2
  135. package/lib/module/contexts/messagesContext/MessagesContext.js.map +1 -1
  136. package/lib/module/contexts/themeContext/utils/theme.js +10 -1
  137. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  138. package/lib/module/icons/Pause.js +61 -0
  139. package/lib/module/icons/Pause.js.map +1 -0
  140. package/lib/module/icons/Play.js +42 -0
  141. package/lib/module/icons/Play.js.map +1 -0
  142. package/lib/module/icons/index.js +26 -0
  143. package/lib/module/icons/index.js.map +1 -1
  144. package/lib/module/mock-builders/api/queryMembers.js +98 -1
  145. package/lib/module/mock-builders/api/queryMembers.js.map +1 -1
  146. package/lib/module/native.js +7 -1
  147. package/lib/module/native.js.map +1 -1
  148. package/lib/module/utils/getUrlOfImageAttachment.js +1 -1
  149. package/lib/module/utils/getUrlOfImageAttachment.js.map +1 -1
  150. package/lib/module/version.json +1 -1
  151. package/lib/typescript/components/Attachment/Gallery.d.ts +1 -1
  152. package/lib/typescript/components/Attachment/VideoThumbnail.d.ts +4 -0
  153. package/lib/typescript/components/Attachment/utils/buildGallery/types.d.ts +1 -0
  154. package/lib/typescript/components/Attachment/utils/getAspectRatio.d.ts +1 -1
  155. package/lib/typescript/components/Channel/Channel.d.ts +1 -1
  156. package/lib/typescript/components/Channel/hooks/useCreateMessagesContext.d.ts +1 -1
  157. package/lib/typescript/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.d.ts +1 -0
  158. package/lib/typescript/components/ChannelPreview/hooks/useChannelPreviewDisplayName.d.ts +4 -4
  159. package/lib/typescript/components/Chat/hooks/useIsOnline.d.ts +1 -1
  160. package/lib/typescript/components/ImageGallery/ImageGallery.d.ts +2 -0
  161. package/lib/typescript/components/ImageGallery/components/AnimatedGalleryVideo.d.ts +27 -0
  162. package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts +18 -2
  163. package/lib/typescript/components/ImageGallery/components/ImageGalleryVideoControl.d.ts +3 -0
  164. package/lib/typescript/components/ImageGallery/components/ProgressControl.d.ts +5 -0
  165. package/lib/typescript/components/ImageGallery/hooks/useImageGalleryGestures.d.ts +36 -0
  166. package/lib/typescript/components/Message/Message.d.ts +9 -3
  167. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
  168. package/lib/typescript/components/Spinner/Spinner.d.ts +7 -1
  169. package/lib/typescript/components/index.d.ts +2 -0
  170. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +3 -1
  171. package/lib/typescript/contexts/messageOverlayContext/MessageOverlayContext.d.ts +1 -0
  172. package/lib/typescript/contexts/messagesContext/MessagesContext.d.ts +2 -0
  173. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +9 -0
  174. package/lib/typescript/icons/Pause.d.ts +3 -0
  175. package/lib/typescript/icons/Play.d.ts +3 -0
  176. package/lib/typescript/icons/index.d.ts +2 -0
  177. package/lib/typescript/mock-builders/api/queryMembers.d.ts +161 -0
  178. package/lib/typescript/mock-builders/api/utils.d.ts +7 -0
  179. package/lib/typescript/mock-builders/generator/user.d.ts +30 -0
  180. package/lib/typescript/mock-builders/mock.d.ts +3 -0
  181. package/lib/typescript/native.d.ts +66 -1
  182. package/package.json +1 -1
  183. package/src/components/Attachment/Attachment.tsx +11 -7
  184. package/src/components/Attachment/Card.tsx +3 -0
  185. package/src/components/Attachment/Gallery.tsx +75 -36
  186. package/src/components/Attachment/VideoThumbnail.tsx +45 -0
  187. package/src/components/Attachment/hooks/useGoToURL.ts +1 -1
  188. package/src/components/Attachment/utils/buildGallery/buildThumbnail.ts +1 -0
  189. package/src/components/Attachment/utils/buildGallery/types.ts +1 -0
  190. package/src/components/Attachment/utils/getAspectRatio.ts +7 -5
  191. package/src/components/Channel/Channel.tsx +4 -0
  192. package/src/components/Channel/hooks/useCreateMessagesContext.ts +2 -0
  193. package/src/components/ChannelPreview/hooks/__tests__/useChannelPreviewDisplayName.test.tsx +83 -0
  194. package/src/components/ChannelPreview/hooks/useChannelPreviewDisplayName.ts +43 -26
  195. package/src/components/Chat/hooks/useIsOnline.ts +7 -7
  196. package/src/components/ImageGallery/ImageGallery.tsx +145 -667
  197. package/src/components/ImageGallery/components/AnimatedGalleryImage.tsx +4 -4
  198. package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +224 -0
  199. package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +114 -19
  200. package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +103 -0
  201. package/src/components/ImageGallery/components/ImageGrid.tsx +12 -25
  202. package/src/components/ImageGallery/components/ProgressControl.tsx +107 -0
  203. package/src/components/ImageGallery/hooks/useImageGalleryGestures.tsx +722 -0
  204. package/src/components/Message/Message.tsx +18 -7
  205. package/src/components/Message/MessageSimple/utils/renderText.tsx +6 -1
  206. package/src/components/Message/hooks/useCreateMessageContext.ts +2 -0
  207. package/src/components/MessageOverlay/MessageOverlay.tsx +2 -0
  208. package/src/components/Reply/Reply.tsx +36 -23
  209. package/src/components/Spinner/Spinner.tsx +11 -4
  210. package/src/components/index.ts +2 -0
  211. package/src/contexts/messageContext/MessageContext.tsx +2 -0
  212. package/src/contexts/messageInputContext/MessageInputContext.tsx +11 -0
  213. package/src/contexts/messageOverlayContext/MessageOverlayContext.tsx +1 -0
  214. package/src/contexts/messagesContext/MessagesContext.tsx +2 -0
  215. package/src/contexts/themeContext/utils/theme.ts +18 -0
  216. package/src/icons/Pause.tsx +14 -0
  217. package/src/icons/Play.tsx +17 -0
  218. package/src/icons/index.ts +2 -0
  219. package/src/mock-builders/api/queryMembers.js +98 -0
  220. package/src/native.ts +59 -1
  221. package/src/utils/getUrlOfImageAttachment.ts +1 -1
  222. package/src/version.json +1 -1
@@ -0,0 +1,161 @@
1
+ export function queryMembersApi(members?: any): {
2
+ response: {
3
+ data: any;
4
+ status: number;
5
+ };
6
+ type: string;
7
+ };
8
+ export namespace ONE_CHANNEL_MEMBER_MOCK {
9
+ namespace okey {
10
+ const banned: boolean;
11
+ const channel_role: string;
12
+ const created_at: string;
13
+ const role: string;
14
+ const shadow_banned: boolean;
15
+ const updated_at: string;
16
+ namespace user {
17
+ const id: string;
18
+ const name: string;
19
+ }
20
+ const user_id: string;
21
+ }
22
+ }
23
+ export namespace GROUP_CHANNEL_MEMBERS_MOCK {
24
+ export namespace ben {
25
+ const banned_1: boolean;
26
+ export { banned_1 as banned };
27
+ const channel_role_1: string;
28
+ export { channel_role_1 as channel_role };
29
+ const created_at_1: string;
30
+ export { created_at_1 as created_at };
31
+ const role_1: string;
32
+ export { role_1 as role };
33
+ const shadow_banned_1: boolean;
34
+ export { shadow_banned_1 as shadow_banned };
35
+ const updated_at_1: string;
36
+ export { updated_at_1 as updated_at };
37
+ export namespace user_1 {
38
+ const id_1: string;
39
+ export { id_1 as id };
40
+ const name_1: string;
41
+ export { name_1 as name };
42
+ }
43
+ export { user_1 as user };
44
+ const user_id_1: string;
45
+ export { user_id_1 as user_id };
46
+ }
47
+ export namespace nick {
48
+ const banned_2: boolean;
49
+ export { banned_2 as banned };
50
+ const channel_role_2: string;
51
+ export { channel_role_2 as channel_role };
52
+ const created_at_2: string;
53
+ export { created_at_2 as created_at };
54
+ const role_2: string;
55
+ export { role_2 as role };
56
+ const shadow_banned_2: boolean;
57
+ export { shadow_banned_2 as shadow_banned };
58
+ const updated_at_2: string;
59
+ export { updated_at_2 as updated_at };
60
+ export namespace user_2 {
61
+ const id_2: string;
62
+ export { id_2 as id };
63
+ const name_2: string;
64
+ export { name_2 as name };
65
+ }
66
+ export { user_2 as user };
67
+ const user_id_2: string;
68
+ export { user_id_2 as user_id };
69
+ }
70
+ export namespace okey_1 {
71
+ const banned_3: boolean;
72
+ export { banned_3 as banned };
73
+ const channel_role_3: string;
74
+ export { channel_role_3 as channel_role };
75
+ const created_at_3: string;
76
+ export { created_at_3 as created_at };
77
+ const role_3: string;
78
+ export { role_3 as role };
79
+ const shadow_banned_3: boolean;
80
+ export { shadow_banned_3 as shadow_banned };
81
+ const updated_at_3: string;
82
+ export { updated_at_3 as updated_at };
83
+ export namespace user_3 {
84
+ const id_3: string;
85
+ export { id_3 as id };
86
+ const name_3: string;
87
+ export { name_3 as name };
88
+ }
89
+ export { user_3 as user };
90
+ const user_id_3: string;
91
+ export { user_id_3 as user_id };
92
+ }
93
+ export { okey_1 as okey };
94
+ export namespace qatest1 {
95
+ const banned_4: boolean;
96
+ export { banned_4 as banned };
97
+ const channel_role_4: string;
98
+ export { channel_role_4 as channel_role };
99
+ const created_at_4: string;
100
+ export { created_at_4 as created_at };
101
+ const role_4: string;
102
+ export { role_4 as role };
103
+ const shadow_banned_4: boolean;
104
+ export { shadow_banned_4 as shadow_banned };
105
+ const updated_at_4: string;
106
+ export { updated_at_4 as updated_at };
107
+ export namespace user_4 {
108
+ const id_4: string;
109
+ export { id_4 as id };
110
+ const name_4: string;
111
+ export { name_4 as name };
112
+ }
113
+ export { user_4 as user };
114
+ const user_id_4: string;
115
+ export { user_id_4 as user_id };
116
+ }
117
+ export namespace thierry {
118
+ const banned_5: boolean;
119
+ export { banned_5 as banned };
120
+ const channel_role_5: string;
121
+ export { channel_role_5 as channel_role };
122
+ const created_at_5: string;
123
+ export { created_at_5 as created_at };
124
+ const role_5: string;
125
+ export { role_5 as role };
126
+ const shadow_banned_5: boolean;
127
+ export { shadow_banned_5 as shadow_banned };
128
+ const updated_at_5: string;
129
+ export { updated_at_5 as updated_at };
130
+ export namespace user_5 {
131
+ const id_5: string;
132
+ export { id_5 as id };
133
+ const name_5: string;
134
+ export { name_5 as name };
135
+ }
136
+ export { user_5 as user };
137
+ const user_id_5: string;
138
+ export { user_id_5 as user_id };
139
+ }
140
+ }
141
+ export namespace ONE_MEMBER_WITH_EMPTY_USER_MOCK {
142
+ export namespace okey_2 {
143
+ const banned_6: boolean;
144
+ export { banned_6 as banned };
145
+ const channel_role_6: string;
146
+ export { channel_role_6 as channel_role };
147
+ const created_at_6: string;
148
+ export { created_at_6 as created_at };
149
+ const role_6: string;
150
+ export { role_6 as role };
151
+ const shadow_banned_6: boolean;
152
+ export { shadow_banned_6 as shadow_banned };
153
+ const updated_at_6: string;
154
+ export { updated_at_6 as updated_at };
155
+ const user_6: {};
156
+ export { user_6 as user };
157
+ const user_id_6: string;
158
+ export { user_id_6 as user_id };
159
+ }
160
+ export { okey_2 as okey };
161
+ }
@@ -0,0 +1,7 @@
1
+ export function mockedApiResponse(response: any, type?: string, status?: number): {
2
+ response: {
3
+ data: any;
4
+ status: number;
5
+ };
6
+ type: string;
7
+ };
@@ -0,0 +1,30 @@
1
+ export function getUserDefaults(): {
2
+ banned: boolean;
3
+ created_at: string;
4
+ id: any;
5
+ image: any;
6
+ name: any;
7
+ online: boolean;
8
+ role: string;
9
+ updated_at: string;
10
+ };
11
+ export function generateUser(options?: {}): {
12
+ banned: boolean;
13
+ created_at: string;
14
+ id: any;
15
+ image: any;
16
+ name: any;
17
+ online: boolean;
18
+ role: string;
19
+ updated_at: string;
20
+ };
21
+ export function generateStaticUser(userNumber: any): {
22
+ banned: boolean;
23
+ created_at: string;
24
+ id: any;
25
+ image: any;
26
+ name: any;
27
+ online: boolean;
28
+ role: string;
29
+ updated_at: string;
30
+ };
@@ -0,0 +1,3 @@
1
+ export function getTestClient(): any;
2
+ export function getTestClientWithUser(user: any): Promise<any>;
3
+ export function getRandomInt(min: any, max: any): any;
@@ -1,4 +1,5 @@
1
- import { FlatList as DefaultFlatList } from 'react-native';
1
+ import type React from 'react';
2
+ import { FlatList as DefaultFlatList, StyleProp, ViewStyle } from 'react-native';
2
3
  import type { NetInfoSubscription } from '@react-native-community/netinfo';
3
4
  import type { Asset, File } from './types/types';
4
5
  declare type CompressImage = ({ compressImageQuality, height, uri, width, }: {
@@ -64,6 +65,69 @@ declare type HapticFeedbackMethod = 'impactHeavy' | 'impactLight' | 'impactMediu
64
65
  declare type TriggerHaptic = (method: HapticFeedbackMethod) => void | never;
65
66
  export declare let triggerHaptic: TriggerHaptic;
66
67
  export declare let SDK: string;
68
+ export declare type PlaybackStatus = {
69
+ didJustFinish: boolean;
70
+ durationMillis: number;
71
+ error: string;
72
+ isBuffering: boolean;
73
+ isLoaded: boolean;
74
+ isLooping: boolean;
75
+ isPlaying: boolean;
76
+ positionMillis: number;
77
+ };
78
+ export declare type VideoProgressData = {
79
+ currentTime?: number;
80
+ playableDuration?: number;
81
+ seekableDuration?: number;
82
+ };
83
+ export declare type VideoPayloadData = {
84
+ audioTracks?: {
85
+ index: number;
86
+ language: string;
87
+ title: string;
88
+ type: string;
89
+ }[];
90
+ currentPosition?: number;
91
+ duration?: number;
92
+ naturalSize?: {
93
+ height: number;
94
+ orientation: 'portrait' | 'landscape';
95
+ width: number;
96
+ };
97
+ textTracks?: {
98
+ index: number;
99
+ language: string;
100
+ title: string;
101
+ type: string;
102
+ }[];
103
+ videoTracks?: {
104
+ bitrate: number;
105
+ codecs: string;
106
+ height: number;
107
+ trackId: number;
108
+ width: number;
109
+ }[];
110
+ };
111
+ export declare type VideoType = {
112
+ paused: boolean;
113
+ uri: string;
114
+ videoRef: React.RefObject<VideoType>;
115
+ onBuffer?: (props: {
116
+ isBuffering: boolean;
117
+ }) => void;
118
+ onEnd?: () => void;
119
+ onLoad?: (payload: VideoPayloadData) => void;
120
+ onLoadStart?: () => void;
121
+ onPlaybackStatusUpdate?: (playbackStatus: PlaybackStatus) => void;
122
+ onProgress?: (data: VideoProgressData) => void;
123
+ onReadyForDisplay?: () => void;
124
+ replayAsync?: () => void;
125
+ resizeMode?: string;
126
+ seek?: (progress: number) => void;
127
+ setPositionAsync?: (position: number) => void;
128
+ style?: StyleProp<ViewStyle>;
129
+ };
130
+ export declare let Video: React.ComponentType<VideoType>;
67
131
  declare type Handlers = {
68
132
  compressImage?: CompressImage;
69
133
  deleteFile?: DeleteFile;
@@ -77,6 +141,7 @@ declare type Handlers = {
77
141
  shareImage?: ShareImage;
78
142
  takePhoto?: TakePhoto;
79
143
  triggerHaptic?: TriggerHaptic;
144
+ Video?: React.ComponentType<VideoType>;
80
145
  };
81
146
  export declare const registerNativeHandlers: (handlers: Handlers) => void;
82
147
  export {};
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": "4.6.1",
4
+ "version": "4.7.0-beta.3",
5
5
  "author": {
6
6
  "company": "Stream.io Inc",
7
7
  "name": "Stream.io Inc"
@@ -75,17 +75,21 @@ const AttachmentWithContext = <
75
75
  );
76
76
  }
77
77
 
78
- if (attachment.type === 'file' || attachment.type === 'audio') {
79
- return <FileAttachment attachment={attachment} />;
80
- }
81
-
82
- if (attachment.type === 'video' && attachment.asset_url) {
78
+ if (attachment.type === 'video' && !attachment.og_scrape_url) {
83
79
  return (
84
- // TODO: Put in video component
85
- <FileAttachment attachment={attachment} />
80
+ <>
81
+ <Gallery videos={[attachment]} />
82
+ {hasAttachmentActions && (
83
+ <AttachmentActions key={`key-actions-${attachment.id}`} {...attachment} />
84
+ )}
85
+ </>
86
86
  );
87
87
  }
88
88
 
89
+ if (attachment.type === 'file' || attachment.type === 'audio') {
90
+ return <FileAttachment attachment={attachment} />;
91
+ }
92
+
89
93
  if (hasAttachmentActions) {
90
94
  return (
91
95
  <>
@@ -149,6 +149,7 @@ const CardWithContext = <
149
149
  onLongPress={(event) => {
150
150
  if (onLongPress) {
151
151
  onLongPress({
152
+ additionalInfo: { url: og_scrape_url },
152
153
  emitter: 'card',
153
154
  event,
154
155
  });
@@ -157,6 +158,7 @@ const CardWithContext = <
157
158
  onPress={(event) => {
158
159
  if (onPress) {
159
160
  onPress({
161
+ additionalInfo: { url: og_scrape_url },
160
162
  defaultHandler: defaultOnPress,
161
163
  emitter: 'card',
162
164
  event,
@@ -166,6 +168,7 @@ const CardWithContext = <
166
168
  onPressIn={(event) => {
167
169
  if (onPressIn) {
168
170
  onPressIn({
171
+ additionalInfo: { url: og_scrape_url },
169
172
  defaultHandler: defaultOnPress,
170
173
  emitter: 'card',
171
174
  event,
@@ -59,7 +59,7 @@ const styles = StyleSheet.create({
59
59
  flexWrap: 'wrap',
60
60
  overflow: 'hidden',
61
61
  },
62
- imageContainer: { padding: 1 },
62
+ imageContainer: { display: 'flex', flexDirection: 'row', justifyContent: 'center', padding: 1 },
63
63
  moreImagesContainer: {
64
64
  alignItems: 'center',
65
65
  justifyContent: 'center',
@@ -76,6 +76,7 @@ export type GalleryPropsWithContext<
76
76
  | 'alignment'
77
77
  | 'groupStyles'
78
78
  | 'images'
79
+ | 'videos'
79
80
  | 'onLongPress'
80
81
  | 'onPress'
81
82
  | 'onPressIn'
@@ -84,7 +85,7 @@ export type GalleryPropsWithContext<
84
85
  > &
85
86
  Pick<
86
87
  MessagesContextValue<StreamChatGenerics>,
87
- 'additionalTouchableProps' | 'legacyImageViewerSwipeBehaviour'
88
+ 'additionalTouchableProps' | 'legacyImageViewerSwipeBehaviour' | 'VideoThumbnail'
88
89
  > &
89
90
  Pick<OverlayContextValue, 'setOverlay'> & {
90
91
  channelId: string | undefined;
@@ -125,6 +126,8 @@ const GalleryWithContext = <
125
126
  setImages,
126
127
  setOverlay,
127
128
  threadList,
129
+ videos,
130
+ VideoThumbnail,
128
131
  } = props;
129
132
 
130
133
  const {
@@ -158,16 +161,17 @@ const GalleryWithContext = <
158
161
  minWidth,
159
162
  };
160
163
 
164
+ const imagesAndVideos = [...(images || []), ...(videos || [])];
161
165
  const { height, invertedDirections, thumbnailGrid, width } = useMemo(
162
166
  () =>
163
167
  buildGallery({
164
- images,
168
+ images: imagesAndVideos,
165
169
  sizeConfig,
166
170
  }),
167
- [images.length],
171
+ [imagesAndVideos.length],
168
172
  );
169
173
 
170
- if (!images?.length) return null;
174
+ if (!imagesAndVideos?.length) return null;
171
175
  const messageText = message?.text;
172
176
  const messageId = message?.id;
173
177
  const numOfColumns = thumbnailGrid.length;
@@ -200,7 +204,7 @@ const GalleryWithContext = <
200
204
  ]}
201
205
  testID={`gallery-${invertedDirections ? 'row' : 'column'}-${colIndex}`}
202
206
  >
203
- {rows.map(({ height, resizeMode, url, width }, rowIndex) => {
207
+ {rows.map(({ height, resizeMode, type, url, width }, rowIndex) => {
204
208
  const defaultOnPress = () => {
205
209
  // Added if-else to keep the logic readable, instead of DRY.
206
210
  // if - legacyImageViewerSwipeBehaviour is disabled
@@ -214,11 +218,28 @@ const GalleryWithContext = <
214
218
  setOverlay('gallery');
215
219
  }
216
220
  };
221
+
222
+ const borderRadius = getGalleryImageBorderRadius({
223
+ alignment,
224
+ colIndex,
225
+ groupStyles,
226
+ hasThreadReplies,
227
+ height,
228
+ invertedDirections,
229
+ messageText,
230
+ numOfColumns,
231
+ numOfRows,
232
+ rowIndex,
233
+ sizeConfig,
234
+ threadList,
235
+ width,
236
+ });
237
+
217
238
  return (
218
239
  <TouchableOpacity
219
240
  activeOpacity={0.8}
220
241
  disabled={preventPress}
221
- key={`gallery-item-${messageId}/${colIndex}/${rowIndex}/${images.length}`}
242
+ key={`gallery-item-${messageId}/${colIndex}/${rowIndex}/${imagesAndVideos.length}`}
222
243
  onLongPress={(event) => {
223
244
  if (onLongPress) {
224
245
  onLongPress({
@@ -258,35 +279,34 @@ const GalleryWithContext = <
258
279
  }-${colIndex}-item-${rowIndex}`}
259
280
  {...additionalTouchableProps}
260
281
  >
261
- <MemoizedGalleryImage
262
- resizeMode={resizeMode}
263
- style={[
264
- getGalleryImageBorderRadius({
265
- alignment,
266
- colIndex,
267
- groupStyles,
268
- hasThreadReplies,
269
- height,
270
- invertedDirections,
271
- messageText,
272
- numOfColumns,
273
- numOfRows,
274
- rowIndex,
275
- sizeConfig,
276
- threadList,
277
- width,
278
- }),
279
- image,
280
- {
281
- height: height - 1,
282
- width: width - 1,
283
- },
284
- ]}
285
- uri={url}
286
- />
282
+ {type === 'video' ? (
283
+ <VideoThumbnail
284
+ style={[
285
+ borderRadius,
286
+ image,
287
+ {
288
+ height: height - 1,
289
+ width: width - 1,
290
+ },
291
+ ]}
292
+ />
293
+ ) : (
294
+ <MemoizedGalleryImage
295
+ resizeMode={resizeMode}
296
+ style={[
297
+ borderRadius,
298
+ image,
299
+ {
300
+ height: height - 1,
301
+ width: width - 1,
302
+ },
303
+ ]}
304
+ uri={url}
305
+ />
306
+ )}
287
307
  {colIndex === numOfColumns - 1 &&
288
308
  rowIndex === numOfRows - 1 &&
289
- images.length > 4 ? (
309
+ imagesAndVideos.length > 4 ? (
290
310
  <View
291
311
  style={[
292
312
  StyleSheet.absoluteFillObject,
@@ -296,7 +316,7 @@ const GalleryWithContext = <
296
316
  ]}
297
317
  >
298
318
  <Text style={[styles.moreImagesText, moreImagesText]}>
299
- {`+${images.length - 4}`}
319
+ {`+${imagesAndVideos.length - 4}`}
300
320
  </Text>
301
321
  </View>
302
322
  ) : null}
@@ -319,12 +339,14 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
319
339
  hasThreadReplies: prevHasThreadReplies,
320
340
  images: prevImages,
321
341
  message: prevMessage,
342
+ videos: prevVideos,
322
343
  } = prevProps;
323
344
  const {
324
345
  groupStyles: nextGroupStyles,
325
346
  hasThreadReplies: nextHasThreadReplies,
326
347
  images: nextImages,
327
348
  message: nextMessage,
349
+ videos: nextVideos,
328
350
  } = nextProps;
329
351
 
330
352
  const messageEqual = prevMessage?.id === nextMessage?.id;
@@ -346,6 +368,15 @@ const areEqual = <StreamChatGenerics extends DefaultStreamChatGenerics = Default
346
368
  );
347
369
  if (!imagesEqual) return false;
348
370
 
371
+ const videosEqual =
372
+ prevVideos.length === nextVideos.length &&
373
+ prevVideos.every(
374
+ (image, index) =>
375
+ getUrlWithoutParams(image.image_url) === getUrlWithoutParams(nextVideos[index].image_url) &&
376
+ getUrlWithoutParams(image.thumb_url) === getUrlWithoutParams(nextVideos[index].thumb_url),
377
+ );
378
+ if (!videosEqual) return false;
379
+
349
380
  return true;
350
381
  };
351
382
 
@@ -376,6 +407,8 @@ export const Gallery = <
376
407
  setImage: propSetImage,
377
408
  setOverlay: propSetOverlay,
378
409
  threadList: propThreadList,
410
+ videos: propVideos,
411
+ VideoThumbnail: PropVideoThumbnail,
379
412
  } = props;
380
413
 
381
414
  const { setImage: contextSetImage, setImages } = useImageGalleryContext<StreamChatGenerics>();
@@ -389,16 +422,19 @@ export const Gallery = <
389
422
  onPressIn: contextOnPressIn,
390
423
  preventPress: contextPreventPress,
391
424
  threadList: contextThreadList,
425
+ videos: contextVideos,
392
426
  } = useMessageContext<StreamChatGenerics>();
393
427
  const {
394
428
  additionalTouchableProps: contextAdditionalTouchableProps,
395
429
  legacyImageViewerSwipeBehaviour,
430
+ VideoThumbnail: ContextVideoThumnbnail,
396
431
  } = useMessagesContext<StreamChatGenerics>();
397
432
  const { setOverlay: contextSetOverlay } = useOverlayContext();
398
433
 
399
434
  const images = propImages || contextImages;
435
+ const videos = propVideos || contextVideos;
400
436
 
401
- if (!images.length) return null;
437
+ if (!images.length && !videos.length) return null;
402
438
 
403
439
  const additionalTouchableProps = propAdditionalTouchableProps || contextAdditionalTouchableProps;
404
440
  const alignment = propAlignment || contextAlignment;
@@ -411,6 +447,7 @@ export const Gallery = <
411
447
  const setImage = propSetImage || contextSetImage;
412
448
  const setOverlay = propSetOverlay || contextSetOverlay;
413
449
  const threadList = propThreadList || contextThreadList;
450
+ const VideoThumbnail = PropVideoThumbnail || ContextVideoThumnbnail;
414
451
 
415
452
  return (
416
453
  <MemoizedGallery
@@ -431,6 +468,8 @@ export const Gallery = <
431
468
  setImages,
432
469
  setOverlay,
433
470
  threadList,
471
+ videos,
472
+ VideoThumbnail,
434
473
  }}
435
474
  />
436
475
  );
@@ -0,0 +1,45 @@
1
+ import React from 'react';
2
+ import { StyleSheet, View, ViewProps } from 'react-native';
3
+
4
+ import { useTheme } from '../../contexts/themeContext/ThemeContext';
5
+ import { Play } from '../../icons';
6
+
7
+ const styles = StyleSheet.create({
8
+ container: {
9
+ alignItems: 'center',
10
+ backgroundColor: 'black',
11
+ display: 'flex',
12
+ height: '100%',
13
+ justifyContent: 'center',
14
+ width: '100%',
15
+ },
16
+ roundedView: {
17
+ alignItems: 'center',
18
+ backgroundColor: '#fff',
19
+ borderRadius: 50,
20
+ display: 'flex',
21
+ height: 36,
22
+ justifyContent: 'center',
23
+ width: 36,
24
+ },
25
+ });
26
+
27
+ export type VideoThumbnailProps = ViewProps;
28
+
29
+ export const VideoThumbnail: React.FC<VideoThumbnailProps> = (props) => {
30
+ const {
31
+ theme: {
32
+ messageSimple: {
33
+ videoThumbnail: { container, roundedView },
34
+ },
35
+ },
36
+ } = useTheme();
37
+ const { style, ...rest } = props;
38
+ return (
39
+ <View {...rest} style={[styles.container, container, style]}>
40
+ <View style={[styles.roundedView, roundedView]}>
41
+ <Play height={24} pathFill={'#000'} width={24} />
42
+ </View>
43
+ </View>
44
+ );
45
+ };
@@ -19,7 +19,7 @@ export const useGoToURL: UseGoToURLType = (url?: string) => {
19
19
  Linking.openURL(finalUrl);
20
20
  } else {
21
21
  setError(true);
22
- console.log(`Don't know how to open URI: ${finalUrl}`);
22
+ console.warn(`Don't know how to open URI: ${finalUrl}`);
23
23
  }
24
24
  });
25
25
 
@@ -36,6 +36,7 @@ export function buildThumbnail<
36
36
  resizeMode: resizeMode
37
37
  ? resizeMode
38
38
  : ((image.original_height && image.original_width ? 'contain' : 'cover') as ImageResizeMode),
39
+ type: image.type,
39
40
  url: shouldResize
40
41
  ? getResizedImageUrl({
41
42
  height,
@@ -6,6 +6,7 @@ export type Thumbnail = {
6
6
  url: string;
7
7
  width: number;
8
8
  id?: string;
9
+ type?: string;
9
10
  };
10
11
 
11
12
  export type GallerySizeConfig = {
@@ -10,12 +10,14 @@ import type { DefaultStreamChatGenerics } from '../../../types/types';
10
10
  */
11
11
  export function getAspectRatio<
12
12
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
13
- >(image: Attachment<StreamChatGenerics>) {
14
- if (image.type !== 'image') {
15
- throw new Error('getAspectRatio() can only be called on an image attachment');
13
+ >(attachment: Attachment<StreamChatGenerics>) {
14
+ if (!(attachment.type === 'image' || attachment.type === 'video')) {
15
+ throw new Error(
16
+ 'getAspectRatio() can only be called on an image attachment or video thumbnail',
17
+ );
16
18
  }
17
19
 
18
- if (!image.original_width || !image.original_height) return 1;
20
+ if (!attachment.original_width || !attachment.original_height) return 1;
19
21
 
20
- return image.original_width / image.original_height;
22
+ return attachment.original_width / attachment.original_height;
21
23
  }