@cometchat/chat-uikit-react-native 5.3.10 → 5.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (138) hide show
  1. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  2. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  3. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  4. package/android/.gradle/7.4/gc.properties +0 -0
  5. package/android/.gradle/vcs-1/gc.properties +0 -0
  6. package/android/src/main/java/com/reactnativecometchatuikit/CometChatClipboardModule.kt +52 -0
  7. package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +1 -0
  8. package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +95 -8
  9. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +237 -6
  10. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorViewManager.kt +2 -1
  11. package/android/src/main/java/com/reactnativecometchatuikit/SoundPlayer.java +85 -47
  12. package/ios/CometChatClipboardModule.m +11 -0
  13. package/ios/CometChatClipboardModule.swift +41 -0
  14. package/ios/FileManager.m +201 -39
  15. package/ios/RichTextEditorView.swift +312 -4
  16. package/ios/RichTextEditorViewManager.m +1 -0
  17. package/ios/SoundPlayer.m +18 -6
  18. package/package.json +9 -7
  19. package/react-native-cometchat-ui-kit.podspec +1 -0
  20. package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +692 -107
  21. package/src/CometChatConversations/CometChatConversations.tsx +19 -6
  22. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +649 -49
  23. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +23 -4
  24. package/src/CometChatMessageList/CometChatMessageList.tsx +463 -54
  25. package/src/CometChatMessageList/MANUAL_TEST_CASES.md +154 -0
  26. package/src/CometChatMessageList/components/MessageListItem.tsx +30 -17
  27. package/src/CometChatMessageList/style.ts +33 -5
  28. package/src/CometChatRichTextEditor/RichTextEditorViewNativeComponent.ts +13 -0
  29. package/src/CometChatRichTextEditor/index.tsx +25 -0
  30. package/src/CometChatSearch/CometChatSearch.tsx +296 -154
  31. package/src/calls/CallingExtension.tsx +19 -13
  32. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +20 -1
  33. package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +20 -9
  34. package/src/index.ts +39 -0
  35. package/src/shared/CometChatUiKit/CometChatUIKit.ts +40 -34
  36. package/src/shared/base/Types.ts +3 -0
  37. package/src/shared/constants/UIKitConstants.ts +15 -1
  38. package/src/shared/framework/DataSource.ts +14 -4
  39. package/src/shared/framework/DataSourceDecorator.tsx +17 -8
  40. package/src/shared/framework/MessageDataSource.tsx +307 -60
  41. package/src/shared/helper/useToast.tsx +29 -0
  42. package/src/shared/icons/components/audio-file-type.tsx +11 -22
  43. package/src/shared/icons/components/document-file-type.tsx +11 -24
  44. package/src/shared/icons/components/image-file-type.tsx +12 -21
  45. package/src/shared/icons/components/link-file-type.tsx +25 -0
  46. package/src/shared/icons/components/pdf-file-type.tsx +11 -22
  47. package/src/shared/icons/components/presentation-file-type.tsx +11 -24
  48. package/src/shared/icons/components/spreadsheet-file-type.tsx +11 -24
  49. package/src/shared/icons/components/text-file-type.tsx +11 -21
  50. package/src/shared/icons/components/unknown-file-type.tsx +21 -25
  51. package/src/shared/icons/components/video-file-type.tsx +11 -24
  52. package/src/shared/icons/components/zip-file-type.tsx +11 -24
  53. package/src/shared/icons/icon-mapping.tsx +2 -0
  54. package/src/shared/index.ts +28 -0
  55. package/src/shared/modals/AttachmentPickerConfiguration.ts +13 -0
  56. package/src/shared/modals/SelectedAttachment.ts +65 -0
  57. package/src/shared/modals/UploadState.ts +10 -0
  58. package/src/shared/modals/index.ts +4 -0
  59. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +42 -1
  60. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +42 -1
  61. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +43 -2
  62. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +43 -2
  63. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +43 -2
  64. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +43 -2
  65. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +43 -2
  66. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +43 -2
  67. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +43 -2
  68. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +43 -2
  69. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +43 -2
  70. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +43 -2
  71. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +43 -2
  72. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +43 -2
  73. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +43 -2
  74. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +43 -2
  75. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +43 -2
  76. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +43 -2
  77. package/src/shared/services/UploadQueueService.ts +145 -0
  78. package/src/shared/services/index.ts +2 -0
  79. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +42 -18
  80. package/src/shared/utils/MessageUtils.tsx +13 -4
  81. package/src/shared/utils/attachmentLimits.ts +156 -0
  82. package/src/shared/utils/audioPlaybackCoordinator.ts +28 -0
  83. package/src/shared/utils/batchMediaContext.tsx +30 -0
  84. package/src/shared/utils/conversationUtils.ts +26 -4
  85. package/src/shared/utils/groupAttachments.ts +93 -0
  86. package/src/shared/utils/index.ts +8 -0
  87. package/src/shared/utils/openMultiFileChooser.ts +123 -0
  88. package/src/shared/utils/partitionAttachmentsByKind.ts +44 -0
  89. package/src/shared/views/ClipboardPasteHandler/ClipboardPasteHandler.ts +28 -0
  90. package/src/shared/views/ClipboardPasteHandler/NativeCometChatClipboardModule.ts +16 -0
  91. package/src/shared/views/ClipboardPasteHandler/index.ts +2 -0
  92. package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +1 -0
  93. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreview.style.ts +32 -0
  94. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreview.tsx +90 -0
  95. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreviewItem.tsx +276 -0
  96. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTile.tsx +827 -0
  97. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTray.tsx +110 -0
  98. package/src/shared/views/CometChatAttachmentPreview/StagedVideoDurationProbe.tsx +53 -0
  99. package/src/shared/views/CometChatAttachmentPreview/index.ts +8 -0
  100. package/src/shared/views/CometChatAttachmentViewer/CometChatAttachmentViewer.tsx +305 -0
  101. package/src/shared/views/CometChatAttachmentViewer/index.ts +2 -0
  102. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +71 -74
  103. package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +587 -0
  104. package/src/shared/views/CometChatAudiosBubble/index.ts +2 -0
  105. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +5 -7
  106. package/src/shared/views/CometChatCaptionText/CometChatCaptionText.tsx +182 -0
  107. package/src/shared/views/CometChatCaptionText/index.ts +2 -0
  108. package/src/shared/views/CometChatComposerErrorBanner.tsx +83 -0
  109. package/src/shared/views/CometChatConversationStarter/CometChatConversationStarter.tsx +141 -0
  110. package/src/shared/views/CometChatConversationStarter/index.ts +2 -0
  111. package/src/shared/views/CometChatConversationSummary/CometChatConversationSummary.tsx +155 -0
  112. package/src/shared/views/CometChatConversationSummary/index.ts +2 -0
  113. package/src/shared/views/CometChatFileBubble/style.ts +6 -4
  114. package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +316 -0
  115. package/src/shared/views/CometChatFilesBubble/index.ts +2 -0
  116. package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +323 -0
  117. package/src/shared/views/CometChatImagesBubble/index.ts +2 -0
  118. package/src/shared/views/CometChatMediaViewer/CometChatMediaViewer.tsx +425 -0
  119. package/src/shared/views/CometChatMediaViewer/index.ts +2 -0
  120. package/src/shared/views/CometChatMediaViewer/mediaViewerUtils.ts +30 -0
  121. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +14 -4
  122. package/src/shared/views/CometChatSendButtonView/CometChatSendButtonView.tsx +1 -0
  123. package/src/shared/views/CometChatSmartReplies/CometChatSmartReplies.tsx +172 -0
  124. package/src/shared/views/CometChatSmartReplies/index.ts +2 -0
  125. package/src/shared/views/CometChatVideoBubble/style.ts +3 -3
  126. package/src/shared/views/CometChatVideosBubble/CometChatVideosBubble.tsx +441 -0
  127. package/src/shared/views/CometChatVideosBubble/index.ts +2 -0
  128. package/src/shared/views/CometChatVoiceNoteBubble/CometChatVoiceNoteBubble.tsx +78 -0
  129. package/src/shared/views/CometChatVoiceNoteBubble/index.ts +2 -0
  130. package/src/shared/views/index.ts +37 -1
  131. package/src/theme/CometChatThemeHelper.ts +8 -0
  132. package/src/theme/default/color/dark.ts +9 -0
  133. package/src/theme/default/color/light.ts +10 -0
  134. package/src/theme/type.ts +73 -0
  135. package/src/CometChatMessageList/PERFORMANCE_ARCHITECTURE.md +0 -478
  136. package/src/CometChatMessageList/SEARCH_NAV_PERF_PLAN.md +0 -613
  137. package/src/shared/CometChatUiKit/CometChatUIKit.changes.md +0 -76
  138. package/src/shared/CometChatUiKit/checkAuthSettings-review.md +0 -211
@@ -0,0 +1,154 @@
1
+ # Manual Test Cases — `loadLastAgentConversation`
2
+
3
+ ## Prerequisites
4
+ - An `@agentic` user configured in your CometChat dashboard
5
+ - The example app running with `loadLastAgentConversation={true}` on `CometChatMessageList`
6
+ - At least one previous conversation with the agent (send a message, get a response)
7
+
8
+ ---
9
+
10
+ ## TC-1: Auto-loads last conversation on open
11
+
12
+ **Steps:**
13
+ 1. Have at least one previous conversation with the agent (send "Hello", wait for reply)
14
+ 2. Navigate away from the agent chat (go back to conversation list)
15
+ 3. Open the agent chat again
16
+
17
+ **Expected:**
18
+ - A loading indicator appears briefly
19
+ - The previous conversation messages load automatically
20
+ - You see your last messages and the agent's responses
21
+
22
+ ---
23
+
24
+ ## TC-2: Shows greeting/empty state when no previous conversation exists
25
+
26
+ **Steps:**
27
+ 1. Use a fresh `@agentic` user with no message history (or use a new logged-in user who hasn't chatted with the agent)
28
+ 2. Open the agent chat
29
+
30
+ **Expected:**
31
+ - The agent greeting view appears (avatar, greeting message, suggested messages)
32
+ - No loading spinner hangs indefinitely
33
+
34
+ ---
35
+
36
+ ## TC-3: "New Chat" button from header shows empty state
37
+
38
+ **Steps:**
39
+ 1. Open the agent chat (previous conversation auto-loads)
40
+ 2. Tap the "New Chat" button (pencil/compose icon) in the header
41
+
42
+ **Expected:**
43
+ - The screen resets to the greeting/empty state
44
+ - The previous conversation is NOT re-loaded
45
+ - You can type a fresh message to start a new conversation
46
+
47
+ ---
48
+
49
+ ## TC-4: "New Chat" button from Chat History drawer works
50
+
51
+ **Steps:**
52
+ 1. Open the agent chat
53
+ 2. Tap the "Chat History" button in the header to open the history drawer
54
+ 3. Tap the "New Chat" button inside the history drawer
55
+
56
+ **Expected:**
57
+ - The history drawer closes
58
+ - The message list resets to greeting/empty state
59
+ - The previous conversation is NOT re-loaded
60
+
61
+ ---
62
+
63
+ ## TC-5: Loading a specific conversation from Chat History still works
64
+
65
+ **Steps:**
66
+ 1. Open the agent chat (previous conversation auto-loads)
67
+ 2. Tap the "Chat History" button in the header
68
+ 3. Tap on a specific past conversation from the list
69
+
70
+ **Expected:**
71
+ - The selected conversation loads with all its messages
72
+ - Streaming/responses still work if you send a new message in that thread
73
+
74
+ ---
75
+
76
+ ## TC-6: Sending a new message after "New Chat" starts a new thread
77
+
78
+ **Steps:**
79
+ 1. Open the agent chat (previous conversation auto-loads)
80
+ 2. Tap "New Chat" (message list resets to empty)
81
+ 3. Type and send a message (e.g., "What's the weather?")
82
+
83
+ **Expected:**
84
+ - Your message appears in the list
85
+ - A streaming indicator shows while the agent responds
86
+ - The agent's reply appears correctly
87
+ - This is now a NEW conversation thread (not appended to the old one)
88
+
89
+ ---
90
+
91
+ ## TC-7: Re-opening after new chat shows the NEW conversation
92
+
93
+ **Steps:**
94
+ 1. Complete TC-6 (start a new chat, send message, get reply)
95
+ 2. Navigate away from the agent chat
96
+ 3. Open the agent chat again
97
+
98
+ **Expected:**
99
+ - The most recent conversation (from step 1-2) auto-loads
100
+ - You see the "What's the weather?" message and the agent's response
101
+ - NOT the older conversation from before
102
+
103
+ ---
104
+
105
+ ## TC-8: `loadLastAgentConversation={false}` preserves existing behavior
106
+
107
+ **Steps:**
108
+ 1. Change the prop to `loadLastAgentConversation={false}` (or remove it) in Messages.tsx
109
+ 2. Open the agent chat (even with previous conversations)
110
+
111
+ **Expected:**
112
+ - The greeting/empty state shows immediately
113
+ - No automatic loading of previous conversation
114
+ - Behaves exactly as before this feature was added
115
+
116
+ ---
117
+
118
+ ## TC-9: Non-agentic users are unaffected
119
+
120
+ **Steps:**
121
+ 1. With `loadLastAgentConversation={true}` still set
122
+ 2. Open a regular (non-agentic) user chat that has message history
123
+
124
+ **Expected:**
125
+ - Messages load normally (standard behavior)
126
+ - No change in behavior — the prop only applies to `@agentic` users
127
+
128
+ ---
129
+
130
+ ## TC-10: Scroll up to load older messages in auto-loaded conversation
131
+
132
+ **Steps:**
133
+ 1. Have a long conversation history with the agent (30+ messages)
134
+ 2. Open the agent chat (auto-loads last conversation)
135
+ 3. Scroll up to the top of the loaded messages
136
+
137
+ **Expected:**
138
+ - Older messages load (pagination works)
139
+ - No crash or infinite spinner
140
+ - The loading indicator appears at the top while fetching
141
+
142
+ ---
143
+
144
+ ## TC-11: Delete all history from Chat History panel
145
+
146
+ **Steps:**
147
+ 1. Open the agent chat
148
+ 2. Open Chat History drawer
149
+ 3. Long-press and delete all conversations one by one until none remain
150
+
151
+ **Expected:**
152
+ - When the last conversation is deleted, the list shows empty state
153
+ - The message list resets to greeting/empty view
154
+ - Re-opening the chat shows greeting (no conversation to auto-load)
@@ -5,8 +5,6 @@ import { CometChatDateSeparator } from '../../shared/views/CometChatDateSeperato
5
5
  import { CometChatTheme } from '../../theme/type';
6
6
  import { CometChatNewMessageIndicator, NewMessageIndicatorStyle } from '../../shared/views';
7
7
 
8
- const SEPARATOR_HEIGHT = 40;
9
-
10
8
  interface MessageListItemProps {
11
9
  item: CometChat.BaseMessage;
12
10
  index: number;
@@ -18,7 +16,11 @@ interface MessageListItemProps {
18
16
  timestamp: number;
19
17
  dayHeaderString: string | undefined;
20
18
  RenderMessageItem: React.ComponentType<any>;
21
- itemSeparator: () => React.ReactNode;
19
+ itemSeparator: (tight?: boolean) => React.ReactNode;
20
+ /** Collapse the TOP padding — the older (above) neighbour is in the same fan-out batch. */
21
+ tightTop?: boolean;
22
+ /** Collapse the BOTTOM padding — the newer (below) neighbour is in the same fan-out batch. */
23
+ tightBottom?: boolean;
22
24
  staticStyles: any;
23
25
  onLayout?: (event: any, messageId: string) => void;
24
26
  showNewMessageIndicator?: boolean;
@@ -39,6 +41,8 @@ const MessageListItemComponent: React.FC<MessageListItemProps> = ({
39
41
  dayHeaderString,
40
42
  RenderMessageItem,
41
43
  itemSeparator,
44
+ tightTop,
45
+ tightBottom,
42
46
  staticStyles,
43
47
  onLayout,
44
48
  showNewMessageIndicator,
@@ -55,21 +59,26 @@ const MessageListItemComponent: React.FC<MessageListItemProps> = ({
55
59
  };
56
60
 
57
61
  return (
58
- <View style={staticStyles.container} onLayout={handleLayout}>
62
+ <View
63
+ style={[
64
+ staticStyles.container,
65
+ tightTop ? staticStyles.messageTightTop : null,
66
+ tightBottom ? staticStyles.messageTightBottom : null,
67
+ ]}
68
+ onLayout={handleLayout}
69
+ >
59
70
  {isHighlighted && (
60
71
  <Animated.View
61
- style={{
62
- backgroundColor: highlightAnimatedValue.interpolate({
63
- inputRange: [0, 1],
64
- outputRange: ['transparent', String(theme.color.extendedPrimary200)],
65
- }),
66
- position: 'absolute',
67
- left: 0,
68
- right: 0,
69
- top: showSeparator ? SEPARATOR_HEIGHT : 0,
70
- bottom: 0,
71
- zIndex: 1,
72
- }}
72
+ style={[
73
+ staticStyles.highlightOverlay,
74
+ showSeparator ? staticStyles.highlightOverlayBelowSeparator : null,
75
+ {
76
+ backgroundColor: highlightAnimatedValue.interpolate({
77
+ inputRange: [0, 1],
78
+ outputRange: ['transparent', String(theme.color.extendedPrimary200)],
79
+ }),
80
+ },
81
+ ]}
73
82
  />
74
83
  )}
75
84
  <View style={staticStyles.contentWrapper}>
@@ -91,7 +100,9 @@ const MessageListItemComponent: React.FC<MessageListItemProps> = ({
91
100
  />
92
101
  )}
93
102
  <RenderMessageItem item={item} theme={theme} idx={index} />
94
- {itemSeparator()}
103
+ {/* The separator sits BELOW the bubble → it faces the newer (below) neighbour, so it must
104
+ collapse with tightBottom (not tightTop) for same-batch rows to read as one group. */}
105
+ {itemSeparator(tightBottom)}
95
106
  </View>
96
107
  </View>
97
108
  );
@@ -110,6 +121,8 @@ export const MessageListItem = memo(MessageListItemComponent, (prevProps, nextPr
110
121
  const visualsUnchanged =
111
122
  prevProps.isHighlighted === nextProps.isHighlighted &&
112
123
  prevProps.showSeparator === nextProps.showSeparator &&
124
+ prevProps.tightTop === nextProps.tightTop &&
125
+ prevProps.tightBottom === nextProps.tightBottom &&
113
126
  prevProps.timestamp === nextProps.timestamp &&
114
127
  prevProps.dayHeaderString === nextProps.dayHeaderString &&
115
128
  prevProps.showNewMessageIndicator === nextProps.showNewMessageIndicator &&
@@ -254,8 +254,12 @@ export const getMessageListStylesLight = (
254
254
  },
255
255
  imageBubbleStyles: {
256
256
  containerStyle: {
257
- padding: spacing.padding.p1,
257
+ // Figma: padding 4px top/right/left, 0 bottom — leaves a thin bubble-color
258
+ // frame around the media; the timestamp row sits flush under the grid.
259
+ paddingTop: spacing.padding.p1,
260
+ paddingRight: spacing.padding.p1,
258
261
  paddingBottom: spacing.padding.p0,
262
+ paddingLeft: spacing.padding.p1,
259
263
  borderRadius: spacing.radius.r3,
260
264
  alignSelf: "flex-start",
261
265
  },
@@ -266,7 +270,10 @@ export const getMessageListStylesLight = (
266
270
  width: 232,
267
271
  },
268
272
  dateReceiptContainerStyle: {
273
+ // Figma: 2px gap between the media grid and the timestamp row.
274
+ paddingTop: spacing.padding.p0_5,
269
275
  paddingRight: spacing.padding.p1,
276
+ paddingBottom: spacing.padding.p1,
270
277
  },
271
278
  },
272
279
  assistantBubbleStyles: {
@@ -486,8 +493,12 @@ export const getMessageListStylesLight = (
486
493
  },
487
494
  imageBubbleStyles: {
488
495
  containerStyle: {
489
- padding: spacing.padding.p1,
496
+ // Figma: padding 4px top/right/left, 0 bottom — leaves a thin bubble-color
497
+ // frame around the media; the timestamp row sits flush under the grid.
498
+ paddingTop: spacing.padding.p1,
499
+ paddingRight: spacing.padding.p1,
490
500
  paddingBottom: spacing.padding.p0,
501
+ paddingLeft: spacing.padding.p1,
491
502
  borderRadius: spacing.radius.r3,
492
503
  overflow: "hidden",
493
504
  },
@@ -499,7 +510,10 @@ export const getMessageListStylesLight = (
499
510
  minWidth: 232,
500
511
  },
501
512
  dateReceiptContainerStyle: {
513
+ // Figma: 2px gap between the media grid and the timestamp row.
514
+ paddingTop: spacing.padding.p0_5,
502
515
  paddingRight: spacing.padding.p1,
516
+ paddingBottom: spacing.padding.p1,
503
517
  },
504
518
  },
505
519
  audioBubbleStyles: getAudioBubbleStyleLight(color, spacing, typography)
@@ -758,8 +772,12 @@ export const getMessageListStylesDark = (
758
772
  },
759
773
  imageBubbleStyles: {
760
774
  containerStyle: {
761
- padding: spacing.padding.p1,
775
+ // Figma: padding 4px top/right/left, 0 bottom — leaves a thin bubble-color
776
+ // frame around the media; the timestamp row sits flush under the grid.
777
+ paddingTop: spacing.padding.p1,
778
+ paddingRight: spacing.padding.p1,
762
779
  paddingBottom: spacing.padding.p0,
780
+ paddingLeft: spacing.padding.p1,
763
781
  borderRadius: spacing.radius.r3,
764
782
  alignSelf: "flex-start",
765
783
  },
@@ -770,12 +788,15 @@ export const getMessageListStylesDark = (
770
788
  width: 232,
771
789
  },
772
790
  dateReceiptContainerStyle: {
791
+ // Figma: 2px gap between the media grid and the timestamp row.
792
+ paddingTop: spacing.padding.p0_5,
773
793
  paddingRight: spacing.padding.p1,
794
+ paddingBottom: spacing.padding.p1,
774
795
  },
775
796
  },
776
797
  assistantBubbleStyles: {
777
798
  containerStyle: {
778
- backgroundColor: "transparent",
799
+ backgroundColor: "transparent",
779
800
  borderRadius: spacing.radius.r3,
780
801
  minWidth: 90,
781
802
  alignSelf: "flex-start",
@@ -991,8 +1012,12 @@ export const getMessageListStylesDark = (
991
1012
  },
992
1013
  imageBubbleStyles: {
993
1014
  containerStyle: {
994
- padding: spacing.padding.p1,
1015
+ // Figma: padding 4px top/right/left, 0 bottom — leaves a thin bubble-color
1016
+ // frame around the media; the timestamp row sits flush under the grid.
1017
+ paddingTop: spacing.padding.p1,
1018
+ paddingRight: spacing.padding.p1,
995
1019
  paddingBottom: spacing.padding.p0,
1020
+ paddingLeft: spacing.padding.p1,
996
1021
  borderRadius: spacing.radius.r3,
997
1022
  overflow: "hidden",
998
1023
  },
@@ -1004,7 +1029,10 @@ export const getMessageListStylesDark = (
1004
1029
  minWidth: 232,
1005
1030
  },
1006
1031
  dateReceiptContainerStyle: {
1032
+ // Figma: 2px gap between the media grid and the timestamp row.
1033
+ paddingTop: spacing.padding.p0_5,
1007
1034
  paddingRight: spacing.padding.p1,
1035
+ paddingBottom: spacing.padding.p1,
1008
1036
  },
1009
1037
  },
1010
1038
  audioBubbleStyles: getAudioBubbleStyleDark(color, spacing, typography)
@@ -67,6 +67,17 @@ type LinkTapEventData = Readonly<{
67
67
  length: Int32;
68
68
  }>;
69
69
 
70
+ // One pasted media item (image or file) extracted to a temp file by the native editor.
71
+ type PasteMediaItem = Readonly<{
72
+ uri: string; // file:// path to the temp copy
73
+ mimeType: string; // real mime type (image/*, application/pdf, …)
74
+ name: string; // display filename with extension
75
+ size: Double; // bytes
76
+ }>;
77
+ type PasteMediaEventData = Readonly<{
78
+ items: ReadonlyArray<PasteMediaItem>;
79
+ }>;
80
+
70
81
  export interface NativeProps extends ViewProps {
71
82
  placeholder?: string;
72
83
  editable?: boolean;
@@ -98,6 +109,8 @@ export interface NativeProps extends ViewProps {
98
109
  onActiveStylesChange?: DirectEventHandler<ActiveStylesEventData>;
99
110
  onLinkTap?: DirectEventHandler<LinkTapEventData>;
100
111
  onSendRequest?: DirectEventHandler<Readonly<{}>>;
112
+ // Fired when the user pastes image(s)/file(s) into the editor (long-press Paste / ⌘V).
113
+ onPasteMedia?: DirectEventHandler<PasteMediaEventData>;
101
114
  }
102
115
 
103
116
  export default requireNativeComponent<NativeProps>(
@@ -101,6 +101,17 @@ interface LinkTapEvent {
101
101
  nativeEvent: LinkTapEventData;
102
102
  }
103
103
 
104
+ /** A single image/file pasted into the editor (extracted to a temp file by native). */
105
+ export interface PasteMediaItem {
106
+ uri: string;
107
+ mimeType: string;
108
+ name: string;
109
+ size: number;
110
+ }
111
+ interface PasteMediaEvent {
112
+ nativeEvent: { items: PasteMediaItem[] };
113
+ }
114
+
104
115
  export interface RichTextEditorPropsExtended extends RichTextEditorProps {
105
116
  /** Test ID for testing frameworks (e.g. Detox, React Native Testing Library) */
106
117
  testID?: string;
@@ -111,6 +122,8 @@ export interface RichTextEditorPropsExtended extends RichTextEditorProps {
111
122
  onLinkTap?: (data: LinkTapEventData) => void;
112
123
  /** Callback when Enter is pressed in "sendMessage" mode (Android only) */
113
124
  onSendRequest?: () => void;
125
+ /** Fired when the user pastes image(s)/file(s) into the editor (long-press Paste / ⌘V). */
126
+ onPasteMedia?: (items: PasteMediaItem[]) => void;
114
127
  /** Enter key behavior: "newLine" (default) or "sendMessage" (Android only) */
115
128
  enterKeyBehavior?: string;
116
129
  /** Show Bold/Italic/Underline/Strikethrough in text selection context menu */
@@ -323,6 +336,17 @@ const RichTextEditor = forwardRef<RichTextEditorRef, RichTextEditorPropsExtended
323
336
  props.onSendRequest?.();
324
337
  }, [props.onSendRequest]);
325
338
 
339
+ const handlePasteMedia = useCallback(
340
+ // permissive event type — bridges the native direct event; shape is checked at runtime
341
+ (event: any) => {
342
+ const items = event?.nativeEvent?.items;
343
+ if (Array.isArray(items) && items.length > 0) {
344
+ props.onPasteMedia?.(items as PasteMediaItem[]);
345
+ }
346
+ },
347
+ [props.onPasteMedia],
348
+ );
349
+
326
350
  const combinedStyle = StyleSheet.flatten([props.style, height != null ? { height } : undefined]);
327
351
 
328
352
  return (
@@ -356,6 +380,7 @@ const RichTextEditor = forwardRef<RichTextEditorRef, RichTextEditorPropsExtended
356
380
  onActiveStylesChange={handleActiveStylesChange}
357
381
  onLinkTap={handleLinkTap}
358
382
  onSendRequest={handleSendRequest}
383
+ onPasteMedia={handlePasteMedia}
359
384
  enterKeyBehavior={props.enterKeyBehavior}
360
385
  showTextSelectionMenuItems={props.showTextSelectionMenuItems ?? true}
361
386
  />