stream-chat-react-native-core 9.0.0-beta.27 → 9.0.0-beta.29

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 (187) hide show
  1. package/lib/commonjs/components/Attachment/Gallery.js +29 -9
  2. package/lib/commonjs/components/Attachment/Gallery.js.map +1 -1
  3. package/lib/commonjs/components/Attachment/Giphy/GiphyImage.js +4 -4
  4. package/lib/commonjs/components/Attachment/Giphy/GiphyImage.js.map +1 -1
  5. package/lib/commonjs/components/Attachment/ImageLoadingFailedIndicator.js +3 -3
  6. package/lib/commonjs/components/Attachment/ImageLoadingFailedIndicator.js.map +1 -1
  7. package/lib/commonjs/components/Attachment/ImageLoadingIndicator.js +1 -1
  8. package/lib/commonjs/components/Attachment/ImageLoadingIndicator.js.map +1 -1
  9. package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js +2 -2
  10. package/lib/commonjs/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js.map +1 -1
  11. package/lib/commonjs/components/Channel/Channel.js +1 -1
  12. package/lib/commonjs/components/Channel/Channel.js.map +1 -1
  13. package/lib/commonjs/components/ChannelList/Skeleton.js +1 -1
  14. package/lib/commonjs/components/ChannelList/Skeleton.js.map +1 -1
  15. package/lib/commonjs/components/ChannelList/hooks/useChannelActionItems.js +0 -15
  16. package/lib/commonjs/components/ChannelList/hooks/useChannelActionItems.js.map +1 -1
  17. package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js +14 -12
  18. package/lib/commonjs/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
  19. package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js +1 -0
  20. package/lib/commonjs/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
  21. package/lib/commonjs/components/ChannelPreview/ChannelSwipableWrapper.js +11 -9
  22. package/lib/commonjs/components/ChannelPreview/ChannelSwipableWrapper.js.map +1 -1
  23. package/lib/commonjs/components/ImageGallery/ImageGallery.js +3 -3
  24. package/lib/commonjs/components/ImageGallery/ImageGallery.js.map +1 -1
  25. package/lib/commonjs/components/Message/Message.js +2 -1
  26. package/lib/commonjs/components/Message/Message.js.map +1 -1
  27. package/lib/commonjs/components/Message/MessageItemView/MessageItemView.js +7 -3
  28. package/lib/commonjs/components/Message/MessageItemView/MessageItemView.js.map +1 -1
  29. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js +3 -1
  30. package/lib/commonjs/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  31. package/lib/commonjs/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.js +1 -1
  32. package/lib/commonjs/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.js.map +1 -1
  33. package/lib/commonjs/components/MessageMenu/MessageUserReactions.js +0 -1
  34. package/lib/commonjs/components/MessageMenu/MessageUserReactions.js.map +1 -1
  35. package/lib/commonjs/components/Poll/components/PollInputDialog.js +1 -1
  36. package/lib/commonjs/components/Poll/components/PollInputDialog.js.map +1 -1
  37. package/lib/commonjs/components/Reply/Reply.js +2 -2
  38. package/lib/commonjs/components/Reply/Reply.js.map +1 -1
  39. package/lib/commonjs/components/ThreadList/ThreadListItemSkeleton.js +1 -1
  40. package/lib/commonjs/components/ThreadList/ThreadListItemSkeleton.js.map +1 -1
  41. package/lib/commonjs/components/UIComponents/BottomSheetModal.js +145 -44
  42. package/lib/commonjs/components/UIComponents/BottomSheetModal.js.map +1 -1
  43. package/lib/commonjs/components/UIComponents/BottomSheetModal.utils.js +53 -0
  44. package/lib/commonjs/components/UIComponents/BottomSheetModal.utils.js.map +1 -0
  45. package/lib/commonjs/components/UIComponents/StreamBottomSheetModalFlatList.js +9 -5
  46. package/lib/commonjs/components/UIComponents/StreamBottomSheetModalFlatList.js.map +1 -1
  47. package/lib/commonjs/components/ui/Avatar/ChannelAvatar.js +1 -1
  48. package/lib/commonjs/components/ui/Avatar/ChannelAvatar.js.map +1 -1
  49. package/lib/commonjs/contexts/bottomSheetContext/BottomSheetContext.js.map +1 -1
  50. package/lib/commonjs/contexts/messageComposerContext/MessageComposerContext.js +4 -4
  51. package/lib/commonjs/contexts/messageComposerContext/MessageComposerContext.js.map +1 -1
  52. package/lib/commonjs/contexts/messageContext/MessageContext.js.map +1 -1
  53. package/lib/commonjs/contexts/overlayContext/ClosingPortalHostsLayer.js +10 -1
  54. package/lib/commonjs/contexts/overlayContext/ClosingPortalHostsLayer.js.map +1 -1
  55. package/lib/commonjs/contexts/overlayContext/MessageOverlayHostLayer.js +16 -7
  56. package/lib/commonjs/contexts/overlayContext/MessageOverlayHostLayer.js.map +1 -1
  57. package/lib/commonjs/hooks/messagePreview/useMessagePreviewText.js +4 -4
  58. package/lib/commonjs/hooks/messagePreview/useMessagePreviewText.js.map +1 -1
  59. package/lib/commonjs/version.json +1 -1
  60. package/lib/module/components/Attachment/Gallery.js +29 -9
  61. package/lib/module/components/Attachment/Gallery.js.map +1 -1
  62. package/lib/module/components/Attachment/Giphy/GiphyImage.js +4 -4
  63. package/lib/module/components/Attachment/Giphy/GiphyImage.js.map +1 -1
  64. package/lib/module/components/Attachment/ImageLoadingFailedIndicator.js +3 -3
  65. package/lib/module/components/Attachment/ImageLoadingFailedIndicator.js.map +1 -1
  66. package/lib/module/components/Attachment/ImageLoadingIndicator.js +1 -1
  67. package/lib/module/components/Attachment/ImageLoadingIndicator.js.map +1 -1
  68. package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js +2 -2
  69. package/lib/module/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.js.map +1 -1
  70. package/lib/module/components/Channel/Channel.js +1 -1
  71. package/lib/module/components/Channel/Channel.js.map +1 -1
  72. package/lib/module/components/ChannelList/Skeleton.js +1 -1
  73. package/lib/module/components/ChannelList/Skeleton.js.map +1 -1
  74. package/lib/module/components/ChannelList/hooks/useChannelActionItems.js +0 -15
  75. package/lib/module/components/ChannelList/hooks/useChannelActionItems.js.map +1 -1
  76. package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js +14 -12
  77. package/lib/module/components/ChannelPreview/ChannelDetailsBottomSheet.js.map +1 -1
  78. package/lib/module/components/ChannelPreview/ChannelPreviewView.js +1 -0
  79. package/lib/module/components/ChannelPreview/ChannelPreviewView.js.map +1 -1
  80. package/lib/module/components/ChannelPreview/ChannelSwipableWrapper.js +11 -9
  81. package/lib/module/components/ChannelPreview/ChannelSwipableWrapper.js.map +1 -1
  82. package/lib/module/components/ImageGallery/ImageGallery.js +3 -3
  83. package/lib/module/components/ImageGallery/ImageGallery.js.map +1 -1
  84. package/lib/module/components/Message/Message.js +2 -1
  85. package/lib/module/components/Message/Message.js.map +1 -1
  86. package/lib/module/components/Message/MessageItemView/MessageItemView.js +7 -3
  87. package/lib/module/components/Message/MessageItemView/MessageItemView.js.map +1 -1
  88. package/lib/module/components/Message/hooks/useCreateMessageContext.js +3 -1
  89. package/lib/module/components/Message/hooks/useCreateMessageContext.js.map +1 -1
  90. package/lib/module/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.js +1 -1
  91. package/lib/module/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.js.map +1 -1
  92. package/lib/module/components/MessageMenu/MessageUserReactions.js +0 -1
  93. package/lib/module/components/MessageMenu/MessageUserReactions.js.map +1 -1
  94. package/lib/module/components/Poll/components/PollInputDialog.js +1 -1
  95. package/lib/module/components/Poll/components/PollInputDialog.js.map +1 -1
  96. package/lib/module/components/Reply/Reply.js +2 -2
  97. package/lib/module/components/Reply/Reply.js.map +1 -1
  98. package/lib/module/components/ThreadList/ThreadListItemSkeleton.js +1 -1
  99. package/lib/module/components/ThreadList/ThreadListItemSkeleton.js.map +1 -1
  100. package/lib/module/components/UIComponents/BottomSheetModal.js +145 -44
  101. package/lib/module/components/UIComponents/BottomSheetModal.js.map +1 -1
  102. package/lib/module/components/UIComponents/BottomSheetModal.utils.js +53 -0
  103. package/lib/module/components/UIComponents/BottomSheetModal.utils.js.map +1 -0
  104. package/lib/module/components/UIComponents/StreamBottomSheetModalFlatList.js +9 -5
  105. package/lib/module/components/UIComponents/StreamBottomSheetModalFlatList.js.map +1 -1
  106. package/lib/module/components/ui/Avatar/ChannelAvatar.js +1 -1
  107. package/lib/module/components/ui/Avatar/ChannelAvatar.js.map +1 -1
  108. package/lib/module/contexts/bottomSheetContext/BottomSheetContext.js.map +1 -1
  109. package/lib/module/contexts/messageComposerContext/MessageComposerContext.js +4 -4
  110. package/lib/module/contexts/messageComposerContext/MessageComposerContext.js.map +1 -1
  111. package/lib/module/contexts/messageContext/MessageContext.js.map +1 -1
  112. package/lib/module/contexts/overlayContext/ClosingPortalHostsLayer.js +10 -1
  113. package/lib/module/contexts/overlayContext/ClosingPortalHostsLayer.js.map +1 -1
  114. package/lib/module/contexts/overlayContext/MessageOverlayHostLayer.js +16 -7
  115. package/lib/module/contexts/overlayContext/MessageOverlayHostLayer.js.map +1 -1
  116. package/lib/module/hooks/messagePreview/useMessagePreviewText.js +4 -4
  117. package/lib/module/hooks/messagePreview/useMessagePreviewText.js.map +1 -1
  118. package/lib/module/version.json +1 -1
  119. package/lib/typescript/components/Attachment/Giphy/GiphyImage.d.ts.map +1 -1
  120. package/lib/typescript/components/ChannelList/hooks/useChannelActionItems.d.ts.map +1 -1
  121. package/lib/typescript/components/ChannelPreview/ChannelDetailsBottomSheet.d.ts +2 -2
  122. package/lib/typescript/components/ChannelPreview/ChannelDetailsBottomSheet.d.ts.map +1 -1
  123. package/lib/typescript/components/ChannelPreview/ChannelPreviewStatus.d.ts +1 -1
  124. package/lib/typescript/components/ChannelPreview/ChannelPreviewStatus.d.ts.map +1 -1
  125. package/lib/typescript/components/ChannelPreview/ChannelPreviewView.d.ts +2 -2
  126. package/lib/typescript/components/ChannelPreview/ChannelPreviewView.d.ts.map +1 -1
  127. package/lib/typescript/components/ChannelPreview/ChannelSwipableWrapper.d.ts +3 -3
  128. package/lib/typescript/components/ChannelPreview/ChannelSwipableWrapper.d.ts.map +1 -1
  129. package/lib/typescript/components/Message/Message.d.ts.map +1 -1
  130. package/lib/typescript/components/Message/MessageItemView/MessageItemView.d.ts +1 -1
  131. package/lib/typescript/components/Message/MessageItemView/MessageItemView.d.ts.map +1 -1
  132. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts +1 -1
  133. package/lib/typescript/components/Message/hooks/useCreateMessageContext.d.ts.map +1 -1
  134. package/lib/typescript/components/MessageMenu/MessageUserReactions.d.ts.map +1 -1
  135. package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts +5 -1
  136. package/lib/typescript/components/UIComponents/BottomSheetModal.d.ts.map +1 -1
  137. package/lib/typescript/components/UIComponents/BottomSheetModal.utils.d.ts +28 -0
  138. package/lib/typescript/components/UIComponents/BottomSheetModal.utils.d.ts.map +1 -0
  139. package/lib/typescript/components/UIComponents/StreamBottomSheetModalFlatList.d.ts.map +1 -1
  140. package/lib/typescript/components/ui/Avatar/ChannelAvatar.d.ts.map +1 -1
  141. package/lib/typescript/contexts/bottomSheetContext/BottomSheetContext.d.ts +1 -0
  142. package/lib/typescript/contexts/bottomSheetContext/BottomSheetContext.d.ts.map +1 -1
  143. package/lib/typescript/contexts/messageContext/MessageContext.d.ts +4 -2
  144. package/lib/typescript/contexts/messageContext/MessageContext.d.ts.map +1 -1
  145. package/lib/typescript/contexts/overlayContext/MessageOverlayHostLayer.d.ts.map +1 -1
  146. package/lib/typescript/hooks/messagePreview/useMessagePreviewText.d.ts.map +1 -1
  147. package/package.json +2 -4
  148. package/src/components/Attachment/Gallery.tsx +21 -5
  149. package/src/components/Attachment/Giphy/GiphyImage.tsx +6 -3
  150. package/src/components/Attachment/ImageLoadingFailedIndicator.tsx +1 -2
  151. package/src/components/Attachment/ImageLoadingIndicator.tsx +1 -1
  152. package/src/components/AttachmentPicker/components/AttachmentMediaPicker/AttachmentPickerItem.tsx +2 -2
  153. package/src/components/Channel/Channel.tsx +1 -1
  154. package/src/components/ChannelList/Skeleton.tsx +1 -1
  155. package/src/components/ChannelList/hooks/__tests__/useChannelActionItems.test.tsx +12 -45
  156. package/src/components/ChannelList/hooks/useChannelActionItems.tsx +1 -19
  157. package/src/components/ChannelPreview/ChannelDetailsBottomSheet.tsx +9 -7
  158. package/src/components/ChannelPreview/ChannelPreviewStatus.tsx +1 -1
  159. package/src/components/ChannelPreview/ChannelPreviewView.tsx +3 -2
  160. package/src/components/ChannelPreview/ChannelSwipableWrapper.tsx +8 -7
  161. package/src/components/ChannelPreview/__tests__/ChannelDetailsBottomSheet.test.tsx +1 -1
  162. package/src/components/ChannelPreview/__tests__/ChannelLastMessagePreview.test.tsx +32 -0
  163. package/src/components/ChannelPreview/__tests__/ChannelSwipableWrapper.test.tsx +5 -2
  164. package/src/components/ImageGallery/ImageGallery.tsx +3 -3
  165. package/src/components/Message/Message.tsx +2 -1
  166. package/src/components/Message/MessageItemView/MessageItemView.tsx +8 -3
  167. package/src/components/Message/MessageItemView/__tests__/MessageContent.test.js +28 -0
  168. package/src/components/Message/MessageItemView/__tests__/MessageItemView.test.js +32 -1
  169. package/src/components/Message/hooks/useCreateMessageContext.ts +3 -0
  170. package/src/components/MessageInput/components/AttachmentPreview/ImageAttachmentUploadPreview.tsx +1 -1
  171. package/src/components/MessageMenu/MessageUserReactions.tsx +1 -5
  172. package/src/components/Poll/components/PollInputDialog.tsx +1 -1
  173. package/src/components/Reply/Reply.tsx +2 -2
  174. package/src/components/ThreadList/ThreadListItemSkeleton.tsx +1 -1
  175. package/src/components/UIComponents/BottomSheetModal.tsx +242 -56
  176. package/src/components/UIComponents/BottomSheetModal.utils.ts +82 -0
  177. package/src/components/UIComponents/StreamBottomSheetModalFlatList.tsx +14 -5
  178. package/src/components/UIComponents/__tests__/BottomSheetModal.utils.test.ts +111 -0
  179. package/src/components/ui/Avatar/ChannelAvatar.tsx +5 -1
  180. package/src/contexts/bottomSheetContext/BottomSheetContext.tsx +1 -0
  181. package/src/contexts/messageComposerContext/MessageComposerContext.tsx +1 -1
  182. package/src/contexts/messageContext/MessageContext.tsx +4 -2
  183. package/src/contexts/overlayContext/ClosingPortalHostsLayer.tsx +11 -1
  184. package/src/contexts/overlayContext/MessageOverlayHostLayer.tsx +17 -10
  185. package/src/hooks/messagePreview/useMessagePreviewText.tsx +5 -6
  186. package/src/version.json +1 -1
  187. package/bin/patch-bottom-sheet-5.1.8-pr-2561.js +0 -246
@@ -8,6 +8,7 @@ import { isTestEnvironment } from '../utils/isTestEnvironment';
8
8
  export type BottomSheetContextValue = {
9
9
  close: (closeAnimationFinishedCallback?: () => void) => void;
10
10
  currentSnapIndex: SharedValue<number>;
11
+ topSnapIndex: SharedValue<number>;
11
12
  };
12
13
 
13
14
  export const BottomSheetContext = React.createContext(
@@ -8,7 +8,7 @@ import {
8
8
  } from './MessageComposerAPIContext';
9
9
 
10
10
  import { ChannelProps } from '../../components';
11
- import { useStableCallback } from '../../hooks';
11
+ import { useStableCallback } from '../../hooks/useStableCallback';
12
12
  import { useCreateMessageComposer } from '../messageInputContext/hooks/useCreateMessageComposer';
13
13
  import { ThreadContextValue } from '../threadContext/ThreadContext';
14
14
  import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';
@@ -4,7 +4,7 @@ import type { View } from 'react-native';
4
4
  import type { Attachment, LocalMessage } from 'stream-chat';
5
5
 
6
6
  import type { ActionHandler } from '../../components/Attachment/Attachment';
7
- import { ReactionSummary } from '../../components/Message/hooks/useProcessReactions';
7
+ import type { ReactionSummary } from '../../components/Message/hooks/useProcessReactions';
8
8
  import type {
9
9
  MessagePressableHandlerPayload,
10
10
  PressableHandlerPayload,
@@ -15,7 +15,7 @@ import type { MessageContentType } from '../../contexts/messagesContext/Messages
15
15
  import type { DeepPartial } from '../../contexts/themeContext/ThemeContext';
16
16
  import type { Theme } from '../../contexts/themeContext/utils/theme';
17
17
 
18
- import { MessageComposerAPIContextValue } from '../messageComposerContext/MessageComposerAPIContext';
18
+ import type { MessageComposerAPIContextValue } from '../messageComposerContext/MessageComposerAPIContext';
19
19
  import { DEFAULT_BASE_CONTEXT_VALUE } from '../utils/defaultBaseContextValue';
20
20
 
21
21
  export type Alignment = 'right' | 'left';
@@ -40,6 +40,8 @@ export type MessageContextValue = {
40
40
  groupStyles: GroupType[];
41
41
  /** Handler for actions. Actions in combination with attachments can be used to build [commands](https://getstream.io/chat/docs/#channel_commands). */
42
42
  handleAction: ActionHandler;
43
+ /** Whether or not any message attachment exposes actions. */
44
+ hasAttachmentActions: boolean;
43
45
  handleToggleReaction: (reactionType: string) => Promise<void>;
44
46
  /** Whether or not message has reactions */
45
47
  hasReactions: boolean;
@@ -36,7 +36,7 @@ const ClosingPortalHostSlot = ({
36
36
  style={style}
37
37
  testID={`closing-portal-host-slot-${hostName}`}
38
38
  >
39
- <PortalHost name={hostName} style={StyleSheet.absoluteFillObject} />
39
+ <PortalHost name={hostName} style={styles.absoluteFill} />
40
40
  </Animated.View>
41
41
  );
42
42
  };
@@ -76,3 +76,13 @@ export const ClosingPortalHostsLayer = ({ closeCoverOpacity }: ClosingPortalHost
76
76
  </>
77
77
  );
78
78
  };
79
+
80
+ const styles = StyleSheet.create({
81
+ absoluteFill: {
82
+ bottom: 0,
83
+ left: 0,
84
+ position: 'absolute',
85
+ right: 0,
86
+ top: 0,
87
+ },
88
+ });
@@ -39,11 +39,11 @@ const DefaultMessageOverlayBackground = () => {
39
39
  } = useTheme();
40
40
 
41
41
  return (
42
- <View pointerEvents='none' style={StyleSheet.absoluteFillObject}>
42
+ <View pointerEvents='none' style={StyleSheet.absoluteFill}>
43
43
  <View
44
44
  pointerEvents='none'
45
45
  style={[
46
- StyleSheet.absoluteFillObject,
46
+ StyleSheet.absoluteFill,
47
47
  {
48
48
  backgroundColor: semantics.badgeBgOverlay,
49
49
  },
@@ -320,10 +320,7 @@ export const MessageOverlayHostLayer = ({ BackgroundComponent }: MessageOverlayH
320
320
  <GestureDetector gesture={tap}>
321
321
  <View pointerEvents='box-none' style={StyleSheet.absoluteFill}>
322
322
  {isActive ? (
323
- <Animated.View
324
- pointerEvents='none'
325
- style={[StyleSheet.absoluteFillObject, backdropStyle]}
326
- >
323
+ <Animated.View pointerEvents='none' style={[StyleSheet.absoluteFill, backdropStyle]}>
327
324
  <OverlayBackground />
328
325
  </Animated.View>
329
326
  ) : null}
@@ -332,13 +329,13 @@ export const MessageOverlayHostLayer = ({ BackgroundComponent }: MessageOverlayH
332
329
  {isActive ? (
333
330
  <Pressable
334
331
  onPress={closeOverlay}
335
- style={StyleSheet.absoluteFillObject}
332
+ style={StyleSheet.absoluteFill}
336
333
  testID='message-overlay-backdrop'
337
334
  />
338
335
  ) : null}
339
336
 
340
337
  <Animated.View style={[topItemStyle, topItemTranslateStyle]} testID='message-overlay-top'>
341
- <PortalHost name='top-item' style={StyleSheet.absoluteFillObject} />
338
+ <PortalHost name='top-item' style={styles.absoluteFill} />
342
339
  </Animated.View>
343
340
 
344
341
  <Animated.View
@@ -346,14 +343,14 @@ export const MessageOverlayHostLayer = ({ BackgroundComponent }: MessageOverlayH
346
343
  style={hostStyle}
347
344
  testID='message-overlay-message'
348
345
  >
349
- <PortalHost name='message-overlay' style={StyleSheet.absoluteFillObject} />
346
+ <PortalHost name='message-overlay' style={styles.absoluteFill} />
350
347
  </Animated.View>
351
348
 
352
349
  <Animated.View
353
350
  style={[bottomItemStyle, bottomItemTranslateStyle]}
354
351
  testID='message-overlay-bottom'
355
352
  >
356
- <PortalHost name='bottom-item' style={StyleSheet.absoluteFillObject} />
353
+ <PortalHost name='bottom-item' style={styles.absoluteFill} />
357
354
  </Animated.View>
358
355
  </View>
359
356
 
@@ -362,3 +359,13 @@ export const MessageOverlayHostLayer = ({ BackgroundComponent }: MessageOverlayH
362
359
  </GestureDetector>
363
360
  );
364
361
  };
362
+
363
+ const styles = StyleSheet.create({
364
+ absoluteFill: {
365
+ bottom: 0,
366
+ left: 0,
367
+ position: 'absolute',
368
+ right: 0,
369
+ top: 0,
370
+ },
371
+ });
@@ -35,7 +35,6 @@ export const useMessagePreviewText = ({
35
35
  const onlyAudio = audios?.length === attachmentsLength;
36
36
  const onlyVoiceRecordings =
37
37
  voiceRecordings?.length && voiceRecordings?.length === attachmentsLength;
38
-
39
38
  if (message?.type === 'deleted') {
40
39
  return 'Message deleted';
41
40
  }
@@ -55,8 +54,12 @@ export const useMessagePreviewText = ({
55
54
  return 'Location';
56
55
  }
57
56
 
57
+ if (giphys?.length) {
58
+ return 'Giphy';
59
+ }
60
+
58
61
  if (message?.text) {
59
- return message?.text;
62
+ return message.text;
60
63
  }
61
64
 
62
65
  if (onlyImages) {
@@ -91,10 +94,6 @@ export const useMessagePreviewText = ({
91
94
  }
92
95
  }
93
96
 
94
- if (giphys?.length) {
95
- return 'Giphy';
96
- }
97
-
98
97
  if (onlyFiles && files?.length === 1) {
99
98
  return files?.[0]?.title;
100
99
  }
package/src/version.json CHANGED
@@ -1,3 +1,3 @@
1
1
  {
2
- "version": "9.0.0-beta.27"
2
+ "version": "9.0.0-beta.29"
3
3
  }
@@ -1,246 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- const fs = require('fs');
4
- const path = require('path');
5
-
6
- const TARGET_VERSION_RANGE = {
7
- maxExclusive: '5.2.7',
8
- minInclusive: '5.1.8',
9
- };
10
-
11
- const FILE_PATCHES = {
12
- 'src/hooks/useBoundingClientRect.ts': {
13
- from: ` // @ts-ignore 👉 https://github.com/facebook/react/commit/53b1f69ba
14
- if (ref.current.unstable_getBoundingClientRect !== null) {
15
- // @ts-ignore https://github.com/facebook/react/commit/53b1f69ba
16
- const layout = ref.current.unstable_getBoundingClientRect();
17
- handler(layout);
18
- return;
19
- }
20
-
21
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable 🤞.
22
- if (ref.current.getBoundingClientRect !== null) {
23
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable.
24
- const layout = ref.current.getBoundingClientRect();
25
- handler(layout);
26
- }`,
27
- to: ` if (
28
- // @ts-ignore 👉 https://github.com/facebook/react/commit/53b1f69ba
29
- ref.current.unstable_getBoundingClientRect !== null &&
30
- // @ts-ignore 👉 https://github.com/facebook/react/commit/53b1f69ba
31
- typeof ref.current.unstable_getBoundingClientRect === 'function'
32
- ) {
33
- // @ts-ignore https://github.com/facebook/react/commit/53b1f69ba
34
- const layout = ref.current.unstable_getBoundingClientRect();
35
- handler(layout);
36
- return;
37
- }
38
-
39
- if (
40
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable.
41
- ref.current.getBoundingClientRect !== null &&
42
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable.
43
- typeof ref.current.getBoundingClientRect === 'function'
44
- ) {
45
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable.
46
- const layout = ref.current.getBoundingClientRect();
47
- handler(layout);
48
- }`,
49
- },
50
- 'lib/module/hooks/useBoundingClientRect.js': {
51
- from: ` // @ts-ignore 👉 https://github.com/facebook/react/commit/53b1f69ba
52
- if (ref.current.unstable_getBoundingClientRect !== null) {
53
- // @ts-ignore https://github.com/facebook/react/commit/53b1f69ba
54
- const layout = ref.current.unstable_getBoundingClientRect();
55
- handler(layout);
56
- return;
57
- }
58
-
59
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable 🤞.
60
- if (ref.current.getBoundingClientRect !== null) {
61
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable.
62
- const layout = ref.current.getBoundingClientRect();
63
- handler(layout);
64
- }`,
65
- to: ` if (
66
- // @ts-ignore 👉 https://github.com/facebook/react/commit/53b1f69ba
67
- ref.current.unstable_getBoundingClientRect !== null &&
68
- // @ts-ignore 👉 https://github.com/facebook/react/commit/53b1f69ba
69
- typeof ref.current.unstable_getBoundingClientRect === 'function') {
70
- // @ts-ignore https://github.com/facebook/react/commit/53b1f69ba
71
- const layout = ref.current.unstable_getBoundingClientRect();
72
- handler(layout);
73
- return;
74
- }
75
-
76
- if (
77
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable 🤞.
78
- ref.current.getBoundingClientRect !== null &&
79
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable.
80
- typeof ref.current.getBoundingClientRect === 'function') {
81
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable.
82
- const layout = ref.current.getBoundingClientRect();
83
- handler(layout);
84
- }`,
85
- },
86
- 'lib/commonjs/hooks/useBoundingClientRect.js': {
87
- from: ` // @ts-ignore 👉 https://github.com/facebook/react/commit/53b1f69ba
88
- if (ref.current.unstable_getBoundingClientRect !== null) {
89
- // @ts-ignore https://github.com/facebook/react/commit/53b1f69ba
90
- const layout = ref.current.unstable_getBoundingClientRect();
91
- handler(layout);
92
- return;
93
- }
94
-
95
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable 🤞.
96
- if (ref.current.getBoundingClientRect !== null) {
97
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable.
98
- const layout = ref.current.getBoundingClientRect();
99
- handler(layout);
100
- }`,
101
- to: ` if (
102
- // @ts-ignore 👉 https://github.com/facebook/react/commit/53b1f69ba
103
- ref.current.unstable_getBoundingClientRect !== null &&
104
- // @ts-ignore 👉 https://github.com/facebook/react/commit/53b1f69ba
105
- typeof ref.current.unstable_getBoundingClientRect === 'function') {
106
- // @ts-ignore https://github.com/facebook/react/commit/53b1f69ba
107
- var layout = ref.current.unstable_getBoundingClientRect();
108
- handler(layout);
109
- return;
110
- }
111
-
112
- if (
113
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable 🤞.
114
- ref.current.getBoundingClientRect !== null &&
115
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable.
116
- typeof ref.current.getBoundingClientRect === 'function') {
117
- // @ts-ignore once it \`unstable_getBoundingClientRect\` gets stable.
118
- var _layout = ref.current.getBoundingClientRect();
119
- handler(_layout);
120
- }`,
121
- },
122
- };
123
-
124
- function resolveBottomSheetPackageDirectory() {
125
- try {
126
- return path.dirname(require.resolve('@gorhom/bottom-sheet/package.json'));
127
- } catch {
128
- return undefined;
129
- }
130
- }
131
-
132
- function readInstalledVersion(bottomSheetPackageDirectory) {
133
- const packageJsonPath = path.join(bottomSheetPackageDirectory, 'package.json');
134
- const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
135
-
136
- return packageJson.version;
137
- }
138
-
139
- function parseVersion(version) {
140
- const [major = '0', minor = '0', patchWithSuffix = '0'] = version.split('.');
141
- const patch = patchWithSuffix.split('-')[0];
142
-
143
- return [major, minor, patch].map((part) => Number.parseInt(part, 10));
144
- }
145
-
146
- function compareVersions(left, right) {
147
- const leftParts = parseVersion(left);
148
- const rightParts = parseVersion(right);
149
-
150
- for (let index = 0; index < 3; index += 1) {
151
- if (leftParts[index] > rightParts[index]) {
152
- return 1;
153
- }
154
-
155
- if (leftParts[index] < rightParts[index]) {
156
- return -1;
157
- }
158
- }
159
-
160
- return 0;
161
- }
162
-
163
- function shouldPatchVersion(version) {
164
- return (
165
- compareVersions(version, TARGET_VERSION_RANGE.minInclusive) >= 0 &&
166
- compareVersions(version, TARGET_VERSION_RANGE.maxExclusive) < 0
167
- );
168
- }
169
-
170
- function patchFile(relativeFilePath, originalContents) {
171
- const patch = FILE_PATCHES[relativeFilePath];
172
-
173
- if (!patch) {
174
- return {
175
- changed: false,
176
- contents: originalContents,
177
- };
178
- }
179
-
180
- const nextContents = originalContents.replace(patch.from, patch.to);
181
-
182
- return {
183
- changed: nextContents !== originalContents,
184
- contents: nextContents,
185
- };
186
- }
187
-
188
- function patchBottomSheet(bottomSheetPackageDirectory) {
189
- const installedVersion = readInstalledVersion(bottomSheetPackageDirectory);
190
-
191
- if (!shouldPatchVersion(installedVersion)) {
192
- return { changedFilesCount: 0, installedVersion, skipped: true };
193
- }
194
-
195
- let changedFilesCount = 0;
196
-
197
- for (const relativeFilePath of Object.keys(FILE_PATCHES)) {
198
- const absoluteFilePath = path.join(bottomSheetPackageDirectory, relativeFilePath);
199
-
200
- if (!fs.existsSync(absoluteFilePath)) {
201
- continue;
202
- }
203
-
204
- const originalContents = fs.readFileSync(absoluteFilePath, 'utf8');
205
- const { changed, contents } = patchFile(relativeFilePath, originalContents);
206
-
207
- if (!changed) {
208
- continue;
209
- }
210
-
211
- fs.writeFileSync(absoluteFilePath, contents);
212
- changedFilesCount += 1;
213
- }
214
-
215
- return { changedFilesCount, installedVersion, skipped: false };
216
- }
217
-
218
- function run() {
219
- const bottomSheetPackageDirectory = resolveBottomSheetPackageDirectory();
220
-
221
- if (!bottomSheetPackageDirectory) {
222
- return;
223
- }
224
-
225
- const result = patchBottomSheet(bottomSheetPackageDirectory);
226
-
227
- if (result.skipped || result.changedFilesCount === 0) {
228
- return;
229
- }
230
-
231
- console.log(
232
- `[stream-chat-react-native-core] Applied gorhom/react-native-bottom-sheet PR #2561 patch to @gorhom/bottom-sheet@${result.installedVersion}.`,
233
- );
234
- }
235
-
236
- if (require.main === module) {
237
- run();
238
- }
239
-
240
- module.exports = {
241
- FILE_PATCHES,
242
- patchFile,
243
- run,
244
- shouldPatchVersion,
245
- TARGET_VERSION_RANGE,
246
- };