stream-chat-react-native-core 4.11.1-beta.4 → 4.12.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 (206) hide show
  1. package/lib/commonjs/components/Attachment/AudioAttachment.js +541 -0
  2. package/lib/commonjs/components/Attachment/AudioAttachment.js.map +1 -0
  3. package/lib/commonjs/components/Attachment/FileAttachmentGroup.js +113 -10
  4. package/lib/commonjs/components/Attachment/FileAttachmentGroup.js.map +1 -1
  5. package/lib/commonjs/components/Attachment/Gallery.js +2 -2
  6. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  7. package/lib/commonjs/components/Attachment/{GallaryImage.js → GalleryImage.js} +3 -3
  8. package/lib/{module/components/Attachment/GallaryImage.js.map → commonjs/components/Attachment/GalleryImage.js.map} +1 -1
  9. package/lib/commonjs/components/Attachment/Giphy.js +1 -1
  10. package/lib/commonjs/components/Attachment/Giphy.js.map +1 -1
  11. package/lib/commonjs/components/Attachment/VideoThumbnail.js +10 -5
  12. package/lib/commonjs/components/Attachment/VideoThumbnail.js.map +1 -1
  13. package/lib/commonjs/components/Avatar/Avatar.js +1 -1
  14. package/lib/commonjs/components/Avatar/Avatar.js.map +1 -1
  15. package/lib/commonjs/components/Avatar/GroupAvatar.js +1 -1
  16. package/lib/commonjs/components/Avatar/GroupAvatar.js.map +1 -1
  17. package/lib/commonjs/components/Channel/Channel.js +18 -13
  18. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  19. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
  20. package/lib/commonjs/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  21. package/lib/commonjs/components/ImageGallery/ImageGallery.js +37 -30
  22. package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
  23. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js +5 -3
  24. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
  25. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js +10 -6
  26. package/lib/commonjs/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
  27. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js +17 -14
  28. package/lib/commonjs/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  29. package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js +1 -0
  30. package/lib/commonjs/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
  31. package/lib/commonjs/components/ImageGallery/components/ImageGalleryOverlay.js +2 -1
  32. package/lib/commonjs/components/ImageGallery/components/ImageGalleryOverlay.js.map +1 -1
  33. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js +37 -18
  34. package/lib/commonjs/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  35. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js +3 -1
  36. package/lib/commonjs/components/ImageGallery/components/ImageGrid.js.map +1 -1
  37. package/lib/commonjs/components/ImageGallery/components/ImageGridHandle.js +5 -4
  38. package/lib/commonjs/components/ImageGallery/components/ImageGridHandle.js.map +1 -1
  39. package/lib/commonjs/components/Message/Message.js +8 -6
  40. package/lib/commonjs/components/Message/Message.js.map +1 -1
  41. package/lib/commonjs/components/Message/MessageSimple/utils/parseLinks.js +1 -1
  42. package/lib/commonjs/components/Message/MessageSimple/utils/parseLinks.js.map +1 -1
  43. package/lib/commonjs/components/Message/MessageSimple/utils/parseLinks.test.js +1 -1
  44. package/lib/commonjs/components/Message/MessageSimple/utils/parseLinks.test.js.map +1 -1
  45. package/lib/commonjs/components/MessageInput/FileUploadPreview.js +125 -35
  46. package/lib/commonjs/components/MessageInput/FileUploadPreview.js.map +1 -1
  47. package/lib/{module/components/ImageGallery/components → commonjs/components/ProgressControl}/ProgressControl.js +37 -24
  48. package/lib/commonjs/components/ProgressControl/ProgressControl.js.map +1 -0
  49. package/lib/commonjs/components/index.js +26 -0
  50. package/lib/commonjs/components/index.js.map +1 -1
  51. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js +5 -2
  52. package/lib/commonjs/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  53. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +7 -2
  54. package/lib/commonjs/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  55. package/lib/commonjs/contexts/themeContext/utils/theme.js +9 -0
  56. package/lib/commonjs/contexts/themeContext/utils/theme.js.map +1 -1
  57. package/lib/commonjs/icons/Pause.js +2 -2
  58. package/lib/commonjs/icons/Pause.js.map +1 -1
  59. package/lib/commonjs/mock-builders/api/channelMocks.js +1 -0
  60. package/lib/commonjs/mock-builders/api/channelMocks.js.map +1 -1
  61. package/lib/commonjs/native.js +13 -5
  62. package/lib/commonjs/native.js.map +1 -1
  63. package/lib/commonjs/version.json +1 -1
  64. package/lib/module/components/Attachment/AudioAttachment.js +541 -0
  65. package/lib/module/components/Attachment/AudioAttachment.js.map +1 -0
  66. package/lib/module/components/Attachment/FileAttachmentGroup.js +113 -10
  67. package/lib/module/components/Attachment/FileAttachmentGroup.js.map +1 -1
  68. package/lib/module/components/Attachment/Gallery.js +2 -2
  69. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  70. package/lib/module/components/Attachment/{GallaryImage.js → GalleryImage.js} +3 -3
  71. package/lib/{commonjs/components/Attachment/GallaryImage.js.map → module/components/Attachment/GalleryImage.js.map} +1 -1
  72. package/lib/module/components/Attachment/Giphy.js +1 -1
  73. package/lib/module/components/Attachment/Giphy.js.map +1 -1
  74. package/lib/module/components/Attachment/VideoThumbnail.js +10 -5
  75. package/lib/module/components/Attachment/VideoThumbnail.js.map +1 -1
  76. package/lib/module/components/Avatar/Avatar.js +1 -1
  77. package/lib/module/components/Avatar/Avatar.js.map +1 -1
  78. package/lib/module/components/Avatar/GroupAvatar.js +1 -1
  79. package/lib/module/components/Avatar/GroupAvatar.js.map +1 -1
  80. package/lib/module/components/Channel/Channel.js +18 -13
  81. package/lib/module/components/Channel/Channel.js.map +1 -1
  82. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js +2 -0
  83. package/lib/module/components/Channel/hooks/useCreateInputMessageInputContext.js.map +1 -1
  84. package/lib/module/components/ImageGallery/ImageGallery.js +37 -30
  85. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  86. package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js +5 -3
  87. package/lib/module/components/ImageGallery/components/AnimatedGalleryImage.js.map +1 -1
  88. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js +10 -6
  89. package/lib/module/components/ImageGallery/components/AnimatedGalleryVideo.js.map +1 -1
  90. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js +17 -14
  91. package/lib/module/components/ImageGallery/components/ImageGalleryFooter.js.map +1 -1
  92. package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js +1 -0
  93. package/lib/module/components/ImageGallery/components/ImageGalleryHeader.js.map +1 -1
  94. package/lib/module/components/ImageGallery/components/ImageGalleryOverlay.js +2 -1
  95. package/lib/module/components/ImageGallery/components/ImageGalleryOverlay.js.map +1 -1
  96. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js +37 -18
  97. package/lib/module/components/ImageGallery/components/ImageGalleryVideoControl.js.map +1 -1
  98. package/lib/module/components/ImageGallery/components/ImageGrid.js +3 -1
  99. package/lib/module/components/ImageGallery/components/ImageGrid.js.map +1 -1
  100. package/lib/module/components/ImageGallery/components/ImageGridHandle.js +5 -4
  101. package/lib/module/components/ImageGallery/components/ImageGridHandle.js.map +1 -1
  102. package/lib/module/components/Message/Message.js +8 -6
  103. package/lib/module/components/Message/Message.js.map +1 -1
  104. package/lib/module/components/Message/MessageSimple/utils/parseLinks.js +1 -1
  105. package/lib/module/components/Message/MessageSimple/utils/parseLinks.js.map +1 -1
  106. package/lib/module/components/Message/MessageSimple/utils/parseLinks.test.js +1 -1
  107. package/lib/module/components/Message/MessageSimple/utils/parseLinks.test.js.map +1 -1
  108. package/lib/module/components/MessageInput/FileUploadPreview.js +125 -35
  109. package/lib/module/components/MessageInput/FileUploadPreview.js.map +1 -1
  110. package/lib/{commonjs/components/ImageGallery/components → module/components/ProgressControl}/ProgressControl.js +37 -24
  111. package/lib/module/components/ProgressControl/ProgressControl.js.map +1 -0
  112. package/lib/module/components/index.js +26 -0
  113. package/lib/module/components/index.js.map +1 -1
  114. package/lib/module/contexts/messageInputContext/MessageInputContext.js +5 -2
  115. package/lib/module/contexts/messageInputContext/MessageInputContext.js.map +1 -1
  116. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js +7 -2
  117. package/lib/module/contexts/messageInputContext/hooks/useCreateMessageInputContext.js.map +1 -1
  118. package/lib/module/contexts/themeContext/utils/theme.js +9 -0
  119. package/lib/module/contexts/themeContext/utils/theme.js.map +1 -1
  120. package/lib/module/icons/Pause.js +2 -2
  121. package/lib/module/icons/Pause.js.map +1 -1
  122. package/lib/module/mock-builders/api/channelMocks.js +1 -0
  123. package/lib/module/mock-builders/api/channelMocks.js.map +1 -1
  124. package/lib/module/native.js +13 -5
  125. package/lib/module/native.js.map +1 -1
  126. package/lib/module/version.json +1 -1
  127. package/lib/typescript/components/Attachment/AudioAttachment.d.ts +26 -0
  128. package/lib/typescript/components/Attachment/FileAttachmentGroup.d.ts +2 -1
  129. package/lib/typescript/components/Attachment/{GallaryImage.d.ts → GalleryImage.d.ts} +0 -0
  130. package/lib/typescript/components/Channel/hooks/useCreateInputMessageInputContext.d.ts +1 -1
  131. package/lib/typescript/components/ImageGallery/__tests__/AnimatedVideoGallery.test.d.ts +1 -0
  132. package/lib/typescript/components/ImageGallery/__tests__/ImageGallery.test.d.ts +1 -0
  133. package/lib/typescript/components/ImageGallery/__tests__/ImageGalleryFooter.test.d.ts +1 -0
  134. package/lib/typescript/components/ImageGallery/__tests__/ImageGalleryGrid.test.d.ts +1 -0
  135. package/lib/typescript/components/ImageGallery/__tests__/ImageGalleryGridHandle.test.d.ts +1 -0
  136. package/lib/typescript/components/ImageGallery/__tests__/ImageGalleryHeader.test.d.ts +1 -0
  137. package/lib/typescript/components/ImageGallery/__tests__/ImageGalleryOverlay.test.d.ts +1 -0
  138. package/lib/typescript/components/ImageGallery/__tests__/ImageGalleryVideoControl.test.d.ts +1 -0
  139. package/lib/typescript/components/ImageGallery/components/AnimatedGalleryImage.d.ts +1 -0
  140. package/lib/typescript/components/ImageGallery/components/AnimatedGalleryVideo.d.ts +2 -3
  141. package/lib/typescript/components/ImageGallery/components/ImageGalleryFooter.d.ts +2 -1
  142. package/lib/typescript/components/ImageGallery/components/ImageGrid.d.ts +2 -3
  143. package/lib/typescript/components/Message/hooks/useMessageActionHandlers.d.ts +1 -1
  144. package/lib/typescript/components/Message/hooks/useMessageActions.d.ts +1 -1
  145. package/lib/typescript/components/MessageInput/FileUploadPreview.d.ts +1 -1
  146. package/lib/typescript/components/MessageInput/__tests__/AudioAttachmentUploadPreviewExpo.test.d.ts +1 -0
  147. package/lib/typescript/components/MessageInput/__tests__/AudioAttachmentUploadPreviewNative.test.d.ts +1 -0
  148. package/lib/typescript/components/ProgressControl/ProgressControl.d.ts +11 -0
  149. package/lib/typescript/components/index.d.ts +2 -0
  150. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +1 -1
  151. package/lib/typescript/contexts/messageInputContext/MessageInputContext.d.ts +7 -1
  152. package/lib/typescript/contexts/messageInputContext/hooks/useCreateMessageInputContext.d.ts +1 -1
  153. package/lib/typescript/contexts/themeContext/utils/theme.d.ts +9 -0
  154. package/lib/typescript/native.d.ts +59 -2
  155. package/package.json +1 -1
  156. package/src/components/Attachment/AudioAttachment.tsx +357 -0
  157. package/src/components/Attachment/FileAttachmentGroup.tsx +96 -7
  158. package/src/components/Attachment/Gallery.tsx +1 -1
  159. package/src/components/Attachment/{GallaryImage.tsx → GalleryImage.tsx} +1 -1
  160. package/src/components/Attachment/Giphy.tsx +1 -1
  161. package/src/components/Attachment/VideoThumbnail.tsx +4 -4
  162. package/src/components/Attachment/__tests__/Gallery.test.js +6 -6
  163. package/src/components/Attachment/__tests__/Giphy.test.js +4 -4
  164. package/src/components/Avatar/Avatar.tsx +1 -1
  165. package/src/components/Avatar/GroupAvatar.tsx +1 -1
  166. package/src/components/Channel/Channel.tsx +3 -0
  167. package/src/components/Channel/hooks/useCreateInputMessageInputContext.ts +2 -0
  168. package/src/components/ImageGallery/ImageGallery.tsx +21 -11
  169. package/src/components/ImageGallery/__tests__/AnimatedVideoGallery.test.tsx +241 -0
  170. package/src/components/ImageGallery/__tests__/ImageGallery.test.tsx +192 -0
  171. package/src/components/ImageGallery/__tests__/ImageGalleryFooter.test.tsx +190 -0
  172. package/src/components/ImageGallery/__tests__/ImageGalleryGrid.test.tsx +98 -0
  173. package/src/components/ImageGallery/__tests__/ImageGalleryGridHandle.test.tsx +79 -0
  174. package/src/components/ImageGallery/__tests__/ImageGalleryHeader.test.tsx +172 -0
  175. package/src/components/ImageGallery/__tests__/ImageGalleryOverlay.test.tsx +94 -0
  176. package/src/components/ImageGallery/__tests__/ImageGalleryVideoControl.test.tsx +84 -0
  177. package/src/components/ImageGallery/components/AnimatedGalleryImage.tsx +3 -0
  178. package/src/components/ImageGallery/components/AnimatedGalleryVideo.tsx +11 -3
  179. package/src/components/ImageGallery/components/ImageGalleryFooter.tsx +9 -2
  180. package/src/components/ImageGallery/components/ImageGalleryHeader.tsx +1 -1
  181. package/src/components/ImageGallery/components/ImageGalleryOverlay.tsx +6 -1
  182. package/src/components/ImageGallery/components/ImageGalleryVideoControl.tsx +27 -9
  183. package/src/components/ImageGallery/components/ImageGrid.tsx +19 -17
  184. package/src/components/ImageGallery/components/ImageGridHandle.tsx +4 -1
  185. package/src/components/Message/Message.tsx +2 -1
  186. package/src/components/Message/MessageSimple/__tests__/MessageContent.test.js +11 -3
  187. package/src/components/Message/MessageSimple/__tests__/__snapshots__/MessageAvatar.test.js.snap +1 -1
  188. package/src/components/Message/MessageSimple/utils/parseLinks.test.ts +4 -0
  189. package/src/components/Message/MessageSimple/utils/parseLinks.ts +1 -1
  190. package/src/components/MessageInput/FileUploadPreview.tsx +162 -66
  191. package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewExpo.test.tsx +196 -0
  192. package/src/components/MessageInput/__tests__/AudioAttachmentUploadPreviewNative.test.tsx +212 -0
  193. package/src/components/MessageInput/__tests__/FileUploadPreview.test.js +64 -0
  194. package/src/components/{ImageGallery/components → ProgressControl}/ProgressControl.tsx +37 -19
  195. package/src/components/Thread/__tests__/__snapshots__/Thread.test.js.snap +4 -4
  196. package/src/components/index.ts +3 -0
  197. package/src/contexts/messageInputContext/MessageInputContext.tsx +11 -0
  198. package/src/contexts/messageInputContext/hooks/useCreateMessageInputContext.ts +5 -1
  199. package/src/contexts/themeContext/utils/theme.ts +15 -0
  200. package/src/icons/Pause.tsx +2 -2
  201. package/src/mock-builders/api/channelMocks.tsx +1 -0
  202. package/src/native.ts +67 -7
  203. package/src/version.json +1 -1
  204. package/lib/commonjs/components/ImageGallery/components/ProgressControl.js.map +0 -1
  205. package/lib/module/components/ImageGallery/components/ProgressControl.js.map +0 -1
  206. package/lib/typescript/components/ImageGallery/components/ProgressControl.d.ts +0 -5
@@ -0,0 +1,84 @@
1
+ import React from 'react';
2
+
3
+ import { act, ReactTestInstance } from 'react-test-renderer';
4
+
5
+ import { fireEvent, render, waitFor } from '@testing-library/react-native';
6
+
7
+ import dayjs from 'dayjs';
8
+ import duration from 'dayjs/plugin/duration';
9
+
10
+ import { ThemeProvider } from '../../../contexts/themeContext/ThemeContext';
11
+ import { defaultTheme } from '../../../contexts/themeContext/utils/theme';
12
+ import type { ImageGalleryFooterVideoControlProps } from '../components/ImageGalleryFooter';
13
+ import { ImageGalleryVideoControl } from '../components/ImageGalleryVideoControl';
14
+
15
+ dayjs.extend(duration);
16
+
17
+ const getComponent = (props: Partial<ImageGalleryFooterVideoControlProps>) => (
18
+ <ThemeProvider theme={defaultTheme}>
19
+ <ImageGalleryVideoControl {...(props as unknown as ImageGalleryFooterVideoControlProps)} />
20
+ </ThemeProvider>
21
+ );
22
+
23
+ describe('ImageGalleryOverlay', () => {
24
+ it('should trigger the onPlayPause when play/pause button is pressed', async () => {
25
+ const onPlayPauseMock = jest.fn();
26
+
27
+ const { queryByA11yLabel } = render(getComponent({ onPlayPause: onPlayPauseMock }));
28
+
29
+ const component = queryByA11yLabel('Play Pause Button') as ReactTestInstance;
30
+
31
+ act(() => {
32
+ fireEvent(component, 'onPress');
33
+ });
34
+
35
+ await waitFor(() => {
36
+ expect(component).not.toBeUndefined();
37
+ expect(onPlayPauseMock).toHaveBeenCalled();
38
+ });
39
+ });
40
+
41
+ it('should render the play icon when paused prop is true', async () => {
42
+ const { queryByA11yLabel } = render(getComponent({ paused: true }));
43
+
44
+ const component = queryByA11yLabel('Play Icon') as ReactTestInstance;
45
+
46
+ await waitFor(() => {
47
+ expect(component).not.toBeUndefined();
48
+ });
49
+ });
50
+
51
+ it('should calculate the videoDuration and progressDuration when they are greater than or equal to 3600', () => {
52
+ jest.spyOn(dayjs, 'duration');
53
+
54
+ const { queryByA11yLabel } = render(
55
+ getComponent({
56
+ duration: 3600,
57
+ progress: 1,
58
+ }),
59
+ );
60
+
61
+ const videoDurationComponent = queryByA11yLabel('Video Duration') as ReactTestInstance;
62
+ const progressDurationComponent = queryByA11yLabel('Progress Duration') as ReactTestInstance;
63
+
64
+ expect(videoDurationComponent.children[0]).toBe('01:00:00');
65
+ expect(progressDurationComponent.children[0]).toBe('01:00:00');
66
+ });
67
+
68
+ it('should calculate the videoDuration and progressDuration when they are less than 3600', () => {
69
+ jest.spyOn(dayjs, 'duration');
70
+
71
+ const { queryByA11yLabel } = render(
72
+ getComponent({
73
+ duration: 60,
74
+ progress: 0.5,
75
+ }),
76
+ );
77
+
78
+ const videoDurationComponent = queryByA11yLabel('Video Duration') as ReactTestInstance;
79
+ const progressDurationComponent = queryByA11yLabel('Progress Duration') as ReactTestInstance;
80
+
81
+ expect(videoDurationComponent.children[0]).toBe('01:00');
82
+ expect(progressDurationComponent.children[0]).toBe('00:30');
83
+ });
84
+ });
@@ -10,6 +10,7 @@ const halfScreenWidth = vw(50);
10
10
  const oneEighth = 1 / 8;
11
11
 
12
12
  type Props = {
13
+ accessibilityLabel: string;
13
14
  index: number;
14
15
  offsetScale: Animated.SharedValue<number>;
15
16
  photo: { uri: string };
@@ -26,6 +27,7 @@ type Props = {
26
27
  export const AnimatedGalleryImage: React.FC<Props> = React.memo(
27
28
  (props) => {
28
29
  const {
30
+ accessibilityLabel,
29
31
  index,
30
32
  offsetScale,
31
33
  photo,
@@ -83,6 +85,7 @@ export const AnimatedGalleryImage: React.FC<Props> = React.memo(
83
85
 
84
86
  return (
85
87
  <Animated.Image
88
+ accessibilityLabel={accessibilityLabel}
86
89
  resizeMode={'contain'}
87
90
  source={{ uri: photo.uri }}
88
91
  style={[
@@ -19,7 +19,7 @@ const screenWidth = vw(100);
19
19
  const halfScreenWidth = vw(50);
20
20
  const oneEighth = 1 / 8;
21
21
 
22
- type Props = {
22
+ export type AnimatedGalleryVideoType = {
23
23
  handleEnd: () => void;
24
24
  handleLoad: (payload: VideoPayloadData) => void;
25
25
  handleProgress: (data: VideoProgressData) => void;
@@ -48,7 +48,7 @@ const styles = StyleSheet.create({
48
48
  },
49
49
  });
50
50
 
51
- export const AnimatedGalleryVideo: React.FC<Props> = React.memo(
51
+ export const AnimatedGalleryVideo: React.FC<AnimatedGalleryVideoType> = React.memo(
52
52
  (props) => {
53
53
  const [opacity, setOpacity] = useState<number>(1);
54
54
  const {
@@ -154,11 +154,17 @@ export const AnimatedGalleryVideo: React.FC<Props> = React.memo(
154
154
  * load on memory.
155
155
  */
156
156
  if (!shouldRender) {
157
- return <View style={[style, { transform: [{ scale: oneEighth }] }]} />;
157
+ return (
158
+ <View
159
+ accessibilityLabel='Empty View Image Gallery'
160
+ style={[style, { transform: [{ scale: oneEighth }] }]}
161
+ />
162
+ );
158
163
  }
159
164
 
160
165
  return (
161
166
  <Animated.View
167
+ accessibilityLabel='Image Gallery Video'
162
168
  style={[
163
169
  style,
164
170
  animatedViewStyles,
@@ -185,11 +191,13 @@ export const AnimatedGalleryVideo: React.FC<Props> = React.memo(
185
191
  paused={paused}
186
192
  resizeMode='contain'
187
193
  style={style}
194
+ testID='video-player'
188
195
  uri={source.uri}
189
196
  videoRef={videoRef}
190
197
  />
191
198
  )}
192
199
  <Animated.View
200
+ accessibilityLabel='Spinner'
193
201
  style={[
194
202
  styles.activityIndicator,
195
203
  {
@@ -64,7 +64,7 @@ export type ImageGalleryFooterCustomComponent<
64
64
 
65
65
  export type ImageGalleryFooterVideoControlProps = {
66
66
  duration: number;
67
- onPlayPause: () => void;
67
+ onPlayPause: (status?: boolean) => void;
68
68
  onProgressDrag: (progress: number) => void;
69
69
  paused: boolean;
70
70
  progress: number;
@@ -92,6 +92,7 @@ export type ImageGalleryFooterCustomComponentProps<
92
92
  type ImageGalleryFooterPropsWithContext<
93
93
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
94
94
  > = ImageGalleryFooterCustomComponentProps<StreamChatGenerics> & {
95
+ accessibilityLabel: string;
95
96
  duration: number;
96
97
  onPlayPause: () => void;
97
98
  onProgressDrag: (progress: number) => void;
@@ -111,6 +112,7 @@ export const ImageGalleryFooterWithContext = <
111
112
  props: ImageGalleryFooterPropsWithContext<StreamChatGenerics>,
112
113
  ) => {
113
114
  const {
115
+ accessibilityLabel,
114
116
  centerElement,
115
117
  duration,
116
118
  GridIcon,
@@ -182,6 +184,7 @@ export const ImageGalleryFooterWithContext = <
182
184
 
183
185
  return (
184
186
  <Animated.View
187
+ accessibilityLabel={accessibilityLabel}
185
188
  onLayout={(event) => setHeight(event.nativeEvent.layout.height)}
186
189
  pointerEvents={'box-none'}
187
190
  style={styles.wrapper}
@@ -204,7 +207,11 @@ export const ImageGalleryFooterWithContext = <
204
207
  {leftElement ? (
205
208
  leftElement({ openGridView, photo, share, shareMenuOpen })
206
209
  ) : (
207
- <TouchableOpacity disabled={shareMenuOpen} onPress={share}>
210
+ <TouchableOpacity
211
+ accessibilityLabel='Share Button'
212
+ disabled={shareMenuOpen}
213
+ onPress={share}
214
+ >
208
215
  <View style={[styles.leftContainer, leftContainer]}>
209
216
  {ShareIcon ? ShareIcon : <ShareIconDefault pathFill={black} />}
210
217
  </View>
@@ -167,7 +167,7 @@ export const ImageGalleryHeader = <
167
167
  {leftElement ? (
168
168
  leftElement({ hideOverlay, photo })
169
169
  ) : (
170
- <TouchableOpacity onPress={hideOverlay}>
170
+ <TouchableOpacity accessibilityLabel='Hide Overlay' onPress={hideOverlay}>
171
171
  <View style={[styles.leftContainer, leftContainer]}>
172
172
  {CloseIcon ? CloseIcon : <Close />}
173
173
  </View>
@@ -74,7 +74,12 @@ export const ImageGalleryOverlay: React.FC<Props> = (props) => {
74
74
  }
75
75
 
76
76
  return (
77
- <TapGestureHandler maxDeltaX={16} maxDeltaY={16} onHandlerStateChange={tapEvent}>
77
+ <TapGestureHandler
78
+ maxDeltaX={16}
79
+ maxDeltaY={16}
80
+ onHandlerStateChange={tapEvent}
81
+ testID='image-gallery-overlay'
82
+ >
78
83
  <Animated.View
79
84
  style={[
80
85
  StyleSheet.absoluteFillObject,
@@ -4,20 +4,18 @@ import { StyleSheet, Text, TouchableOpacity, View } from 'react-native';
4
4
  import dayjs from 'dayjs';
5
5
 
6
6
  import type { ImageGalleryFooterVideoControlProps } from './ImageGalleryFooter';
7
- import { ProgressControl } from './ProgressControl';
8
7
 
9
8
  import { useTheme } from '../../../contexts/themeContext/ThemeContext';
10
9
 
11
10
  import { Pause, Play } from '../../../icons';
11
+ import { ProgressControl } from '../../ProgressControl/ProgressControl';
12
12
 
13
13
  const styles = StyleSheet.create({
14
14
  durationTextStyle: {
15
- color: '#fff',
16
15
  fontWeight: 'bold',
17
16
  },
18
17
  roundedView: {
19
18
  alignItems: 'center',
20
- backgroundColor: '#fff',
21
19
  borderRadius: 50,
22
20
  display: 'flex',
23
21
  elevation: 2,
@@ -55,6 +53,7 @@ export const ImageGalleryVideoControl: React.FC<ImageGalleryFooterVideoControlPr
55
53
 
56
54
  const {
57
55
  theme: {
56
+ colors: { static_black, static_white },
58
57
  imageGallery: {
59
58
  videoControl: { durationTextStyle, roundedView, videoContainer },
60
59
  },
@@ -63,25 +62,44 @@ export const ImageGalleryVideoControl: React.FC<ImageGalleryFooterVideoControlPr
63
62
 
64
63
  return (
65
64
  <View style={[styles.videoContainer, videoContainer]}>
66
- <TouchableOpacity onPress={onPlayPause}>
67
- <View style={[styles.roundedView, roundedView]}>
65
+ <TouchableOpacity
66
+ accessibilityLabel='Play Pause Button'
67
+ onPress={() => {
68
+ onPlayPause();
69
+ }}
70
+ >
71
+ <View style={[styles.roundedView, roundedView, { backgroundColor: static_white }]}>
68
72
  {paused ? (
69
- <Play height={24} pathFill={'#000'} width={24} />
73
+ <Play accessibilityLabel='Play Icon' height={24} pathFill={static_black} width={24} />
70
74
  ) : (
71
- <Pause height={24} width={24} />
75
+ <Pause
76
+ accessibilityLabel='Pause Icon'
77
+ height={24}
78
+ pathFill={static_black}
79
+ width={24}
80
+ />
72
81
  )}
73
82
  </View>
74
83
  </TouchableOpacity>
75
- <Text style={[styles.durationTextStyle, durationTextStyle]}>
84
+ <Text
85
+ accessibilityLabel='Progress Duration'
86
+ style={[styles.durationTextStyle, durationTextStyle, { color: static_white }]}
87
+ >
76
88
  {progressDuration ? progressDuration : '00:00'}
77
89
  </Text>
78
90
  <ProgressControl
79
91
  duration={duration}
92
+ filledColor={static_white}
80
93
  onPlayPause={onPlayPause}
81
94
  onProgressDrag={onProgressDrag}
82
95
  progress={progress}
96
+ testID={'progress-control'}
97
+ width={180}
83
98
  />
84
- <Text style={[styles.durationTextStyle, durationTextStyle]}>
99
+ <Text
100
+ accessibilityLabel='Video Duration'
101
+ style={[styles.durationTextStyle, durationTextStyle, { color: static_white }]}
102
+ >
85
103
  {videoDuration ? videoDuration : '00:00'}
86
104
  </Text>
87
105
  </View>
@@ -82,7 +82,7 @@ const GridImage = <
82
82
  }
83
83
 
84
84
  return (
85
- <TouchableOpacity onPress={selectAndClose}>
85
+ <TouchableOpacity accessibilityLabel='Grid Image' onPress={selectAndClose}>
86
86
  {type === 'video' ? (
87
87
  <View style={[styles.image, { height: size, width: size }, gridImage]}>
88
88
  <VideoThumbnail />
@@ -102,26 +102,27 @@ const renderItem = <
102
102
  item: GridImageItem<StreamChatGenerics>;
103
103
  }) => <GridImage item={item} />;
104
104
 
105
- type Props<StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics> =
106
- ImageGalleryGridImageComponents<StreamChatGenerics> & {
107
- closeGridView: () => void;
108
- photos: Photo<StreamChatGenerics>[];
109
- setImage: React.Dispatch<
110
- React.SetStateAction<
111
- | {
112
- messageId?: string | undefined;
113
- url?: string | undefined;
114
- }
115
- | undefined
116
- >
117
- >;
118
- numberOfImageGalleryGridColumns?: number;
119
- };
105
+ export type ImageGridType<
106
+ StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
107
+ > = ImageGalleryGridImageComponents<StreamChatGenerics> & {
108
+ closeGridView: () => void;
109
+ photos: Photo<StreamChatGenerics>[];
110
+ setImage: React.Dispatch<
111
+ React.SetStateAction<
112
+ | {
113
+ messageId?: string | undefined;
114
+ url?: string | undefined;
115
+ }
116
+ | undefined
117
+ >
118
+ >;
119
+ numberOfImageGalleryGridColumns?: number;
120
+ };
120
121
 
121
122
  export const ImageGrid = <
122
123
  StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics,
123
124
  >(
124
- props: Props<StreamChatGenerics>,
125
+ props: ImageGridType<StreamChatGenerics>,
125
126
  ) => {
126
127
  const {
127
128
  avatarComponent,
@@ -154,6 +155,7 @@ export const ImageGrid = <
154
155
 
155
156
  return (
156
157
  <BottomSheetFlatList<GridImageItem<StreamChatGenerics>>
158
+ accessibilityLabel='Image Grid'
157
159
  contentContainerStyle={[
158
160
  styles.contentContainer,
159
161
  { backgroundColor: white },
@@ -60,7 +60,10 @@ export const ImageGridHandle: React.FC<Props> = (props) => {
60
60
  const { t } = useTranslationContext();
61
61
 
62
62
  return (
63
- <View style={[styles.handle, { backgroundColor: white }, handle]}>
63
+ <View
64
+ accessibilityLabel='Image Grid Handle'
65
+ style={[styles.handle, { backgroundColor: white }, handle]}
66
+ >
64
67
  {leftComponent ? leftComponent({ closeGridView }) : <View style={styles.leftContainer} />}
65
68
  {centerComponent ? (
66
69
  centerComponent({ closeGridView })
@@ -342,6 +342,8 @@ const MessageWithContext = <
342
342
  } else if (cur.type === 'video' && !cur.og_scrape_url) {
343
343
  acc.files.push(cur);
344
344
  acc.other = []; // remove other attachments if a file exists
345
+ } else if (cur.type === 'audio') {
346
+ acc.files.push(cur);
345
347
  } else if (cur.type === 'image' && !cur.title_link && !cur.og_scrape_url) {
346
348
  /**
347
349
  * this next if is not combined with the above one for cases where we have
@@ -371,7 +373,6 @@ const MessageWithContext = <
371
373
  other: [] as Attachment<StreamChatGenerics>[],
372
374
  videos: [] as Attachment<StreamChatGenerics>[],
373
375
  };
374
-
375
376
  /**
376
377
  * Check if any actions to prevent long press
377
378
  */
@@ -188,15 +188,23 @@ describe('MessageContent', () => {
188
188
  it('renders the FileAttachment component when a file attachment exists', async () => {
189
189
  const user = generateUser();
190
190
  const message = generateMessage({
191
- attachments: [{ title: 'file', type: 'file' }],
191
+ attachments: [
192
+ { title: 'file', type: 'file' },
193
+ { title: 'audio', type: 'audio' },
194
+ { title: 'video', type: 'video' },
195
+ ],
192
196
  user,
193
197
  });
194
198
 
195
- const { getByTestId } = renderMessage({ message });
199
+ const { getByTestId, queryAllByA11yLabel, queryAllByTestId } = renderMessage({ message });
200
+
201
+ const fileAttachments = queryAllByTestId('file-attachment');
202
+ const audioAttachments = queryAllByA11yLabel('audio-attachment-preview');
196
203
 
197
204
  await waitFor(() => {
198
205
  expect(getByTestId('message-content-wrapper')).toBeTruthy();
199
- expect(getByTestId('file-attachment')).toBeTruthy();
206
+ expect(fileAttachments).toHaveLength(1);
207
+ expect(audioAttachments).toHaveLength(1);
200
208
  });
201
209
  });
202
210
 
@@ -32,7 +32,7 @@ exports[`MessageAvatar should render message avatar 1`] = `
32
32
  }
33
33
  >
34
34
  <Image
35
- accessibilityLabel="avatar-image"
35
+ accessibilityLabel="Avatar Image"
36
36
  onError={[Function]}
37
37
  source={
38
38
  Object {
@@ -22,6 +22,10 @@ describe('parseLinksFromText', () => {
22
22
  ],
23
23
  ['127.0.0.1/local_(development)_server', '127.0.0.1/local_(development)_server'],
24
24
  ['https://a.co:8999/ab.php?p=12', 'a.co:8999/ab.php?p=12'],
25
+ [
26
+ 'http://help.apple.com/xcode/mac/current/#/devba7f53ad4',
27
+ 'help.apple.com/xcode/mac/current/#/devba7f53ad4',
28
+ ],
25
29
  ])('Returns the encoded value of %p as %p', (link, expected) => {
26
30
  const result = parseLinksFromText(link);
27
31
 
@@ -11,7 +11,7 @@ const schema = `(\\w{2,15}:\\/\\/)`;
11
11
  // something.tld OR 123.123.123.123
12
12
  const domain = `((?:\\w+\\.[a-zA-Z]+)+(?:[^:\\/\\s]+)|(?:\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}))`;
13
13
  const port = `(:[0-9]{1,5})`;
14
- const path = `((?:\\/)?[^?#\\s]+)`;
14
+ const path = `((?:\\/)?[^?\\s]+)`;
15
15
  const queryString = `(\\?[^#\\s]+)`;
16
16
  const fragment = `(#[\\w_-]+)`;
17
17