@cometchat/chat-uikit-react-native 5.6.0 → 5.7.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 (167) hide show
  1. package/android/src/main/java/com/reactnativecometchatuikit/CometChatKeyboardModule.kt +101 -0
  2. package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +1 -0
  3. package/android/src/main/java/com/reactnativecometchatuikit/KeyboardDirectionWatcher.kt +64 -0
  4. package/android/src/main/java/com/reactnativecometchatuikit/KeyboardLanguageDirection.kt +44 -0
  5. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +287 -49
  6. package/ios/CometChatKeyboardModule.m +9 -0
  7. package/ios/CometChatKeyboardModule.swift +71 -0
  8. package/ios/KeyboardLanguageDirection.swift +24 -0
  9. package/ios/RichTextEditorView.swift +253 -51
  10. package/ios/RichTextEditorViewManager.m +1 -0
  11. package/package.json +1 -1
  12. package/src/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.tsx +41 -57
  13. package/src/CometChatAIAssistantChatHistory/Skeleton.tsx +4 -1
  14. package/src/CometChatAIAssistantChatHistory/style.ts +5 -2
  15. package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +21 -8
  16. package/src/CometChatCompactMessageComposer/styles.ts +7 -7
  17. package/src/CometChatConversations/CometChatConversations.tsx +36 -30
  18. package/src/CometChatConversations/Skeleton.tsx +4 -1
  19. package/src/CometChatConversations/style.ts +1 -1
  20. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +35 -18
  21. package/src/CometChatGroupMembers/Skeleton.tsx +4 -1
  22. package/src/CometChatGroupMembers/style.ts +6 -4
  23. package/src/CometChatGroups/CometChatGroups.tsx +13 -6
  24. package/src/CometChatGroups/GroupsStyle.ts +1 -1
  25. package/src/CometChatGroups/Skeleton.tsx +4 -1
  26. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +44 -30
  27. package/src/CometChatMessageComposer/styles.tsx +1 -1
  28. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +22 -13
  29. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +8 -1
  30. package/src/CometChatMessageInformation/Skeleton.tsx +4 -1
  31. package/src/CometChatMessageList/CometChatMessageList.tsx +97 -128
  32. package/src/CometChatMessageList/SwipeToReplyView.tsx +61 -0
  33. package/src/CometChatMessageList/style.ts +32 -32
  34. package/src/CometChatMessageList/swipeToReply.ts +25 -0
  35. package/src/CometChatNotificationFeed/CometChatNotificationFeed.tsx +10 -3
  36. package/src/CometChatNotificationFeed/style.ts +1 -1
  37. package/src/CometChatNotificationFeed/utils.ts +17 -18
  38. package/src/CometChatPinnedMessages/CometChatPinnedMessages.tsx +8 -1
  39. package/src/CometChatPinnedMessages/style.ts +5 -5
  40. package/src/CometChatRichTextEditor/RichTextEditorViewNativeComponent.ts +2 -0
  41. package/src/CometChatRichTextEditor/index.tsx +3 -0
  42. package/src/CometChatSavedMessages/CometChatSavedMessages.tsx +14 -11
  43. package/src/CometChatSavedMessages/style.ts +3 -3
  44. package/src/CometChatSearch/CometChatSearch.tsx +38 -35
  45. package/src/CometChatSearch/Skeleton.tsx +4 -1
  46. package/src/CometChatSearch/searchLabels.ts +26 -0
  47. package/src/CometChatSearch/style.ts +7 -7
  48. package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +11 -7
  49. package/src/CometChatThreadHeader/Header.tsx +2 -2
  50. package/src/CometChatUsers/CometChatUsers.tsx +8 -1
  51. package/src/CometChatUsers/Skeleton.tsx +4 -1
  52. package/src/CometChatUsers/style.ts +1 -1
  53. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +8 -1
  54. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +16 -4
  55. package/src/calls/CometChatCallLogs/Skeleton.tsx +4 -1
  56. package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +11 -3
  57. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +10 -2
  58. package/src/extensions/CollaborativeBubble/style.ts +4 -4
  59. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +1 -1
  60. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +1 -1
  61. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +11 -6
  62. package/src/extensions/LinkPreview/style.ts +6 -6
  63. package/src/extensions/Polls/Header.tsx +1 -1
  64. package/src/extensions/Polls/Polls.tsx +25 -12
  65. package/src/extensions/Polls/PollsBubble.tsx +10 -6
  66. package/src/extensions/Polls/style.ts +4 -4
  67. package/src/extensions/Stickers/CometChatStickerKeyboard/CometChatStickerKeyboard.tsx +2 -2
  68. package/src/extensions/Stickers/CometChatStickerKeyboard/Skeleton.tsx +1 -1
  69. package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +1 -1
  70. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +2 -2
  71. package/src/index.ts +5 -1
  72. package/src/shared/CometChatUiKit/CometChatUIKit.ts +17 -0
  73. package/src/shared/CometChatUiKit/UIKitSettings.ts +8 -0
  74. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +13 -10
  75. package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +15 -7
  76. package/src/shared/formatters/CometChatTextFormatter.ts +11 -0
  77. package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +7 -4
  78. package/src/shared/framework/MessageDataSource.tsx +17 -94
  79. package/src/shared/helper/LocalizedDateHelper.ts +64 -4
  80. package/src/shared/helper/helperFunctions.ts +71 -4
  81. package/src/shared/helper/keyboardDirection.ts +54 -0
  82. package/src/shared/helper/layoutDirection.ts +205 -0
  83. package/src/shared/helper/pluralRules.ts +67 -0
  84. package/src/shared/helper/textDirection.ts +118 -0
  85. package/src/shared/icons/Icon.tsx +37 -2
  86. package/src/shared/icons/components/format-list-numbered-rtl.tsx +15 -0
  87. package/src/shared/offline/OfflineViews.tsx +5 -1
  88. package/src/shared/offline/notices.ts +15 -21
  89. package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +2 -0
  90. package/src/shared/resources/CometChatLocalizeNew/resources/ar/translation.json +720 -0
  91. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +50 -2
  92. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +51 -3
  93. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +50 -2
  94. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +51 -3
  95. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +50 -2
  96. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +50 -2
  97. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +50 -2
  98. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +50 -2
  99. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +50 -2
  100. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +58 -2
  101. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +50 -2
  102. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +50 -2
  103. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +50 -2
  104. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +66 -2
  105. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +50 -2
  106. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +50 -2
  107. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +50 -2
  108. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +50 -2
  109. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +13 -12
  110. package/src/shared/utils/CometChatMessagePreview/style.ts +1 -1
  111. package/src/shared/utils/MessageUtils.tsx +14 -14
  112. package/src/shared/utils/PermissionUtil.ts +16 -5
  113. package/src/shared/utils/attachmentLimits.ts +3 -2
  114. package/src/shared/utils/conversationUtils.ts +3 -5
  115. package/src/shared/utils/fileIconFontSize.ts +10 -0
  116. package/src/shared/utils/fileSizeLabel.ts +16 -0
  117. package/src/shared/utils/groupActionText.ts +75 -0
  118. package/src/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.tsx +12 -8
  119. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreview.style.ts +1 -1
  120. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreviewItem.tsx +5 -3
  121. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTile.tsx +22 -17
  122. package/src/shared/views/CometChatAttachmentViewer/CometChatAttachmentViewer.tsx +13 -9
  123. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +16 -10
  124. package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +10 -6
  125. package/src/shared/views/CometChatBadge/CometChatBadge.tsx +8 -4
  126. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +6 -2
  127. package/src/shared/views/CometChatComposerErrorBanner.tsx +3 -1
  128. package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +8 -3
  129. package/src/shared/views/CometChatConversationStarter/CometChatConversationStarter.tsx +2 -2
  130. package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +5 -3
  131. package/src/shared/views/CometChatEmojiKeyboard/emojis.ts +8 -8
  132. package/src/shared/views/CometChatEmojiKeyboard/style.ts +2 -2
  133. package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +5 -4
  134. package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +7 -3
  135. package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +29 -23
  136. package/src/shared/views/CometChatInlineAudioRecorder/CometChatInlineAudioRecorder.tsx +41 -21
  137. package/src/shared/views/CometChatInlineAudioRecorder/useAudioRecorder.ts +7 -3
  138. package/src/shared/views/CometChatLinkConfirmPopup/CometChatLinkConfirmPopup.tsx +7 -3
  139. package/src/shared/views/CometChatList/CometChatList.tsx +10 -14
  140. package/src/shared/views/CometChatList/Header.tsx +5 -2
  141. package/src/shared/views/CometChatList/sectionLetter.ts +44 -0
  142. package/src/shared/views/CometChatList/styles.ts +7 -7
  143. package/src/shared/views/CometChatListItem/CometChatListItem.tsx +6 -4
  144. package/src/shared/views/CometChatMediaRecorder/CometChatAudioPlayer.tsx +16 -10
  145. package/src/shared/views/CometChatMediaRecorder/Timer.tsx +5 -1
  146. package/src/shared/views/CometChatMediaViewer/CometChatMediaViewer.tsx +16 -11
  147. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +24 -4
  148. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +18 -2
  149. package/src/shared/views/CometChatNewMessageIndicator/CometChatNewMessageIndicator.tsx +3 -2
  150. package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +3 -2
  151. package/src/shared/views/CometChatReactionList/ReactionListStyle.tsx +2 -2
  152. package/src/shared/views/CometChatReactionList/Skeleton.tsx +4 -1
  153. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +6 -2
  154. package/src/shared/views/CometChatReportDialog/CometChatReportDialog.tsx +7 -3
  155. package/src/shared/views/CometChatReportDialog/style.ts +1 -1
  156. package/src/shared/views/CometChatSmartReplies/CometChatSmartReplies.tsx +1 -1
  157. package/src/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.tsx +20 -13
  158. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +3 -2
  159. package/src/shared/views/CometChatSuggestionList/Skeleton.tsx +1 -1
  160. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +29 -3
  161. package/src/shared/views/CometChatTooltipMenu/CometChatTooltipMenu.tsx +20 -30
  162. package/src/shared/views/CometChatTooltipMenu/tooltipPosition.ts +43 -0
  163. package/src/shared/views/CometChatVideoBubble/style.ts +2 -2
  164. package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +4 -1
  165. package/src/shared/views/CometChatVideosBubble/CometChatVideosBubble.tsx +22 -22
  166. package/src/shared/views/SenderLabel.tsx +41 -0
  167. package/src/theme/default/default.ts +1 -1
@@ -0,0 +1,61 @@
1
+ import React, { useCallback, useState } from "react";
2
+ import { Animated } from "react-native";
3
+ import {
4
+ PanGestureHandler,
5
+ PanGestureHandlerGestureEvent,
6
+ PanGestureHandlerStateChangeEvent,
7
+ State,
8
+ } from "react-native-gesture-handler";
9
+ import { useKitRTL } from "../shared/helper/layoutDirection";
10
+ import { shouldReply, swipeOffset } from "./swipeToReply";
11
+
12
+ type Props = {
13
+ /** Emits the reply. Called only when a released drag qualifies (swipeToReply.ts). */
14
+ onReply: () => void;
15
+ /** Checked on release — e.g. an outgoing message still under moderation can't be replied to. */
16
+ canReply: () => boolean;
17
+ children: React.ReactNode;
18
+ };
19
+
20
+ /**
21
+ * ENG-41315: a message bubble that slides toward the end side to reply — right in LTR, left in RTL.
22
+ * Its own component so only swipeable rows pay for the gesture state, and its hooks never sit
23
+ * behind the message list's template checks.
24
+ */
25
+ export const SwipeToReplyView = ({ onReply, canReply, children }: Props) => {
26
+ // useState initialiser: one Animated.Value per row, not a new one discarded every render.
27
+ const [offset] = useState(() => new Animated.Value(0));
28
+ const isRTL = useKitRTL();
29
+
30
+ const onGestureEvent = useCallback(
31
+ (event: PanGestureHandlerGestureEvent) => {
32
+ offset.setValue(swipeOffset(event.nativeEvent.translationX, isRTL));
33
+ },
34
+ [offset, isRTL]
35
+ );
36
+
37
+ const onHandlerStateChange = useCallback(
38
+ (event: PanGestureHandlerStateChangeEvent) => {
39
+ const { state, translationX, velocityX } = event.nativeEvent;
40
+ // Cancelled or failed (the list's scroll took over, the app went to the background) must
41
+ // spring back too, or the bubble stays shifted sideways.
42
+ if (state !== State.END && state !== State.CANCELLED && state !== State.FAILED) return;
43
+ Animated.spring(offset, { toValue: 0, useNativeDriver: true }).start();
44
+ if (state === State.END && canReply() && shouldReply(translationX, velocityX, isRTL)) {
45
+ onReply();
46
+ }
47
+ },
48
+ [offset, isRTL, canReply, onReply]
49
+ );
50
+
51
+ return (
52
+ <PanGestureHandler
53
+ onGestureEvent={onGestureEvent}
54
+ onHandlerStateChange={onHandlerStateChange}
55
+ activeOffsetX={[-10, 10]}
56
+ failOffsetY={[-50, 50]}
57
+ >
58
+ <Animated.View style={{ transform: [{ translateX: offset }] }}>{children}</Animated.View>
59
+ </PanGestureHandler>
60
+ );
61
+ };
@@ -105,7 +105,7 @@ export const getMessageListStylesLight = (
105
105
  flexDirection: "column",
106
106
  alignItems: "center",
107
107
  backgroundColor: color.background1,
108
- right: 10,
108
+ end: 10,
109
109
  bottom: 2,
110
110
  gap: spacing.padding.p1,
111
111
  borderRadius: spacing.radius.max,
@@ -211,7 +211,7 @@ export const getMessageListStylesLight = (
211
211
  containerStyle: {
212
212
  paddingTop: spacing.padding.p2,
213
213
  paddingBottom: spacing.padding.p2,
214
- paddingLeft: spacing.padding.p1,
214
+ paddingStart: spacing.padding.p1,
215
215
  },
216
216
  textStyle: {
217
217
  color: color.receiveBubbleTimestamp,
@@ -257,9 +257,9 @@ export const getMessageListStylesLight = (
257
257
  // Figma: padding 4px top/right/left, 0 bottom — leaves a thin bubble-color
258
258
  // frame around the media; the timestamp row sits flush under the grid.
259
259
  paddingTop: spacing.padding.p1,
260
- paddingRight: spacing.padding.p1,
260
+ paddingEnd: spacing.padding.p1,
261
261
  paddingBottom: spacing.padding.p0,
262
- paddingLeft: spacing.padding.p1,
262
+ paddingStart: spacing.padding.p1,
263
263
  borderRadius: spacing.radius.r3,
264
264
  alignSelf: "flex-start",
265
265
  },
@@ -272,7 +272,7 @@ export const getMessageListStylesLight = (
272
272
  dateReceiptContainerStyle: {
273
273
  // Figma: 2px gap between the media grid and the timestamp row.
274
274
  paddingTop: spacing.padding.p0_5,
275
- paddingRight: spacing.padding.p1,
275
+ paddingEnd: spacing.padding.p1,
276
276
  paddingBottom: spacing.padding.p1,
277
277
  },
278
278
  },
@@ -348,9 +348,9 @@ export const getMessageListStylesLight = (
348
348
  borderRadius: spacing.radius.r5,
349
349
  backgroundColor: color.primary,
350
350
  paddingTop: 1,
351
- paddingRight: spacing.padding.p1,
351
+ paddingEnd: spacing.padding.p1,
352
352
  paddingBottom: 3,
353
- paddingLeft: spacing.padding.p1,
353
+ paddingStart: spacing.padding.p1,
354
354
  },
355
355
  textStyle: {
356
356
  ...typography.caption2.regular,
@@ -403,10 +403,10 @@ export const getMessageListStylesLight = (
403
403
  containerStyle: {
404
404
  backgroundColor: "#F9EAEF",
405
405
  paddingVertical: 6,
406
- borderBottomLeftRadius: 8,
407
- borderBottomRightRadius: 8,
408
- borderTopLeftRadius: 0,
409
- borderTopRightRadius: 0,
406
+ borderBottomStartRadius: 8,
407
+ borderBottomEndRadius: 8,
408
+ borderTopStartRadius: 0,
409
+ borderTopEndRadius: 0,
410
410
  flexDirection: "row",
411
411
  alignItems: "center",
412
412
  },
@@ -496,9 +496,9 @@ export const getMessageListStylesLight = (
496
496
  // Figma: padding 4px top/right/left, 0 bottom — leaves a thin bubble-color
497
497
  // frame around the media; the timestamp row sits flush under the grid.
498
498
  paddingTop: spacing.padding.p1,
499
- paddingRight: spacing.padding.p1,
499
+ paddingEnd: spacing.padding.p1,
500
500
  paddingBottom: spacing.padding.p0,
501
- paddingLeft: spacing.padding.p1,
501
+ paddingStart: spacing.padding.p1,
502
502
  borderRadius: spacing.radius.r3,
503
503
  overflow: "hidden",
504
504
  },
@@ -512,7 +512,7 @@ export const getMessageListStylesLight = (
512
512
  dateReceiptContainerStyle: {
513
513
  // Figma: 2px gap between the media grid and the timestamp row.
514
514
  paddingTop: spacing.padding.p0_5,
515
- paddingRight: spacing.padding.p1,
515
+ paddingEnd: spacing.padding.p1,
516
516
  paddingBottom: spacing.padding.p1,
517
517
  },
518
518
  },
@@ -552,9 +552,9 @@ export const getMessageListStylesLight = (
552
552
  borderRadius: spacing.radius.r5,
553
553
  backgroundColor: color.primary,
554
554
  paddingTop: 1,
555
- paddingRight: spacing.padding.p1,
555
+ paddingEnd: spacing.padding.p1,
556
556
  paddingBottom: 3,
557
- paddingLeft: spacing.padding.p1,
557
+ paddingStart: spacing.padding.p1,
558
558
  },
559
559
  textStyle: {
560
560
  ...typography.caption2.regular,
@@ -621,7 +621,7 @@ export const getMessageListStylesDark = (
621
621
  flexDirection: "column",
622
622
  alignItems: "center",
623
623
  backgroundColor: color.background3,
624
- right: 10,
624
+ end: 10,
625
625
  bottom: 2,
626
626
  gap: spacing.padding.p1,
627
627
  borderRadius: spacing.radius.max,
@@ -729,7 +729,7 @@ export const getMessageListStylesDark = (
729
729
  containerStyle: {
730
730
  paddingTop: spacing.padding.p2,
731
731
  paddingBottom: spacing.padding.p2,
732
- paddingLeft: spacing.padding.p1,
732
+ paddingStart: spacing.padding.p1,
733
733
  },
734
734
  textStyle: {
735
735
  color: color.receiveBubbleTimestamp,
@@ -775,9 +775,9 @@ export const getMessageListStylesDark = (
775
775
  // Figma: padding 4px top/right/left, 0 bottom — leaves a thin bubble-color
776
776
  // frame around the media; the timestamp row sits flush under the grid.
777
777
  paddingTop: spacing.padding.p1,
778
- paddingRight: spacing.padding.p1,
778
+ paddingEnd: spacing.padding.p1,
779
779
  paddingBottom: spacing.padding.p0,
780
- paddingLeft: spacing.padding.p1,
780
+ paddingStart: spacing.padding.p1,
781
781
  borderRadius: spacing.radius.r3,
782
782
  alignSelf: "flex-start",
783
783
  },
@@ -790,7 +790,7 @@ export const getMessageListStylesDark = (
790
790
  dateReceiptContainerStyle: {
791
791
  // Figma: 2px gap between the media grid and the timestamp row.
792
792
  paddingTop: spacing.padding.p0_5,
793
- paddingRight: spacing.padding.p1,
793
+ paddingEnd: spacing.padding.p1,
794
794
  paddingBottom: spacing.padding.p1,
795
795
  },
796
796
  },
@@ -875,9 +875,9 @@ export const getMessageListStylesDark = (
875
875
  borderRadius: spacing.radius.r5,
876
876
  backgroundColor: color.primary,
877
877
  paddingTop: 1,
878
- paddingRight: spacing.padding.p1,
878
+ paddingEnd: spacing.padding.p1,
879
879
  paddingBottom: 3,
880
- paddingLeft: spacing.padding.p1,
880
+ paddingStart: spacing.padding.p1,
881
881
  },
882
882
  textStyle: {
883
883
  ...typography.caption2.regular,
@@ -921,10 +921,10 @@ export const getMessageListStylesDark = (
921
921
  containerStyle: {
922
922
  backgroundColor: "#3A0C05",
923
923
  paddingVertical: 6,
924
- borderBottomLeftRadius: 8,
925
- borderBottomRightRadius: 8,
926
- borderTopLeftRadius: 0,
927
- borderTopRightRadius: 0,
924
+ borderBottomStartRadius: 8,
925
+ borderBottomEndRadius: 8,
926
+ borderTopStartRadius: 0,
927
+ borderTopEndRadius: 0,
928
928
  flexDirection: "row",
929
929
  alignItems: "center",
930
930
  overflow: 'hidden',
@@ -1015,9 +1015,9 @@ export const getMessageListStylesDark = (
1015
1015
  // Figma: padding 4px top/right/left, 0 bottom — leaves a thin bubble-color
1016
1016
  // frame around the media; the timestamp row sits flush under the grid.
1017
1017
  paddingTop: spacing.padding.p1,
1018
- paddingRight: spacing.padding.p1,
1018
+ paddingEnd: spacing.padding.p1,
1019
1019
  paddingBottom: spacing.padding.p0,
1020
- paddingLeft: spacing.padding.p1,
1020
+ paddingStart: spacing.padding.p1,
1021
1021
  borderRadius: spacing.radius.r3,
1022
1022
  overflow: "hidden",
1023
1023
  },
@@ -1031,7 +1031,7 @@ export const getMessageListStylesDark = (
1031
1031
  dateReceiptContainerStyle: {
1032
1032
  // Figma: 2px gap between the media grid and the timestamp row.
1033
1033
  paddingTop: spacing.padding.p0_5,
1034
- paddingRight: spacing.padding.p1,
1034
+ paddingEnd: spacing.padding.p1,
1035
1035
  paddingBottom: spacing.padding.p1,
1036
1036
  },
1037
1037
  },
@@ -1080,9 +1080,9 @@ export const getMessageListStylesDark = (
1080
1080
  borderRadius: spacing.radius.r5,
1081
1081
  backgroundColor: color.primary,
1082
1082
  paddingTop: 1,
1083
- paddingRight: spacing.padding.p1,
1083
+ paddingEnd: spacing.padding.p1,
1084
1084
  paddingBottom: 3,
1085
- paddingLeft: spacing.padding.p1,
1085
+ paddingStart: spacing.padding.p1,
1086
1086
  },
1087
1087
  textStyle: {
1088
1088
  ...typography.caption2.regular,
@@ -0,0 +1,25 @@
1
+ // ENG-41315: swipe-to-reply goes toward the end side — right in LTR, left in RTL. Gesture
2
+ // translation/velocity and translateX are physical; these helpers work in "toward the end" terms.
3
+
4
+ export const SWIPE_REPLY_THRESHOLD = 80;
5
+ export const SWIPE_MAX_DISTANCE = 120;
6
+ export const SWIPE_FLICK_VELOCITY = 500;
7
+
8
+ /** Physical translateX for the bubble while dragging; 0 when dragged toward the start side. */
9
+ export function swipeOffset(translationX: number, isRTL: boolean): number {
10
+ const sign = isRTL ? -1 : 1;
11
+ const towardEnd = translationX * sign;
12
+ return towardEnd <= 0 ? 0 : Math.min(towardEnd, SWIPE_MAX_DISTANCE) * sign;
13
+ }
14
+
15
+ /**
16
+ * Whether a released drag replies: far enough toward the end, or flicked toward the end. The flick
17
+ * only counts when the drag itself went toward the end — a drag back toward the start followed
18
+ * by a quick end-ward flick on release doesn't reply.
19
+ */
20
+ export function shouldReply(translationX: number, velocityX: number, isRTL: boolean): boolean {
21
+ const sign = isRTL ? -1 : 1;
22
+ const towardEnd = translationX * sign;
23
+ if (towardEnd <= 0) return false;
24
+ return towardEnd > SWIPE_REPLY_THRESHOLD || velocityX * sign > SWIPE_FLICK_VELOCITY;
25
+ }
@@ -38,6 +38,7 @@ import { Skeleton } from "./Skeleton";
38
38
  import Header from "../shared/views/CometChatList/Header";
39
39
  import { ErrorEmptyView } from "../shared/views/ErrorEmptyView/ErrorEmptyView";
40
40
  import NotificationEmptyIcon from "../shared/icons/components/notification-empty";
41
+ import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection } from "../shared/helper/layoutDirection";
41
42
  import { readListPage } from "../shared/offline/twoPhase";
42
43
  import { useOfflineSessionEnded } from "../shared/offline/useOfflineSessionEnded";
43
44
  import { useOfflineReconnect } from "../shared/offline/useOfflineReconnect";
@@ -77,6 +78,8 @@ interface CardAction {
77
78
  * Props interface for CometChatNotificationFeed.
78
79
  */
79
80
  export interface CometChatNotificationFeedInterface {
81
+ /** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
82
+ layoutDirection?: "ltr" | "rtl";
80
83
  // ─── Content Configuration ───────────────────────────────────
81
84
  /** Feed title. Default: "Notifications" */
82
85
  title?: string;
@@ -144,6 +147,8 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
144
147
  cardThemeMode = "auto",
145
148
  cardThemeOverride,
146
149
  } = props;
150
+ // ENG-41333: own setting → enclosing component → global; drives the root and the context.
151
+ const direction = useComponentLayoutDirection(props.layoutDirection);
147
152
 
148
153
  // ─── Theme & Styles ──────────────────────────────────────────
149
154
  const theme = useTheme();
@@ -591,7 +596,7 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
591
596
  containerStyle={mergedStyles.headerContainerStyle}
592
597
  titleStyle={mergedStyles.titleStyle}
593
598
  backButtonIconStyle={mergedStyles.backButtonIconStyle}
594
- backButtonIconContainerStyle={{ paddingRight: theme.spacing.spacing.s2 }}
599
+ backButtonIconContainerStyle={{ paddingEnd: theme.spacing.spacing.s2 }}
595
600
  hideSearch={true}
596
601
  />
597
602
  );
@@ -602,7 +607,7 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
602
607
  if (!showFilterChips) return null;
603
608
 
604
609
  const allChips = [
605
- { id: ALL_CATEGORY_ID, label: "All", filterKey: null as string | null },
610
+ { id: ALL_CATEGORY_ID, label: t("ALL"), filterKey: null as string | null },
606
611
  ...categories.map((cat: any, index: number) => ({
607
612
  id: `chip_${index}_${cat.label ?? cat.id}`,
608
613
  label: cat?.label || "",
@@ -838,7 +843,8 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
838
843
 
839
844
  // ─── Render: Loaded State ────────────────────────────────────
840
845
  return (
841
- <View style={mergedStyles.containerStyle}>
846
+ <LayoutDirectionContext.Provider value={direction}>
847
+ <View style={[mergedStyles.containerStyle, directionStyle(direction)]}>
842
848
  {renderHeader()}
843
849
  {renderFilterChips()}
844
850
  {isFetchingItems ? (
@@ -871,5 +877,6 @@ export const CometChatNotificationFeed = (props: CometChatNotificationFeedInterf
871
877
  />
872
878
  )}
873
879
  </View>
880
+ </LayoutDirectionContext.Provider>
874
881
  );
875
882
  };
@@ -257,7 +257,7 @@ export const getNotificationFeedStyleLight = (
257
257
  borderRadius: spacing.radius.max,
258
258
  position: "absolute",
259
259
  top: spacing.spacing.s3,
260
- left: spacing.spacing.s2,
260
+ start: spacing.spacing.s2,
261
261
  },
262
262
  unreadIndicatorColor: color.primary,
263
263
 
@@ -8,22 +8,19 @@
8
8
  * Total count invariant: no items lost or duplicated.
9
9
  */
10
10
 
11
+ import { getCometChatTranslation, getCurrentLanguage } from "../shared/resources/CometChatLocalizeNew/LocalizationManager";
12
+ import { LocalizedDateHelper, localizeDigits } from "../shared/helper/LocalizedDateHelper";
13
+
11
14
  /** Represents a single timestamp group (section) for SectionList */
12
15
  export interface TimestampGroup<T> {
13
16
  title: string;
14
17
  data: T[];
15
18
  }
16
19
 
17
- /** Day names for "this week" grouping */
18
- const DAY_NAMES = [
19
- "Sunday",
20
- "Monday",
21
- "Tuesday",
22
- "Wednesday",
23
- "Thursday",
24
- "Friday",
25
- "Saturday",
26
- ] as const;
20
+ const t = getCometChatTranslation();
21
+
22
+ /** The kit language as a date-formatting locale (e.g. "ar" → Arabic day and month names). */
23
+ const dateLocale = () => LocalizedDateHelper.getFullLocaleForDateFormatting(getCurrentLanguage());
27
24
 
28
25
  /**
29
26
  * Returns the start of a given day (midnight) for comparison purposes.
@@ -50,21 +47,23 @@ const getGroupLabel = (sentAt: number, now: Date): string => {
50
47
  const diffDays = Math.floor(diffMs / (24 * 60 * 60 * 1000));
51
48
 
52
49
  if (diffDays === 0) {
53
- return "Today";
50
+ return t("TODAY");
54
51
  }
55
52
  if (diffDays === 1) {
56
- return "Yesterday";
53
+ return t("YESTERDAY");
57
54
  }
58
55
  // Within this week (2-6 days ago) — show day name
59
56
  if (diffDays >= 2 && diffDays <= 6) {
60
- return DAY_NAMES[itemDate.getDay()];
57
+ return itemDate.toLocaleDateString(dateLocale(), { weekday: "long" });
61
58
  }
62
59
  // Older — show localized date
63
- return itemDate.toLocaleDateString(undefined, {
64
- month: "short",
65
- day: "numeric",
66
- year: "numeric",
67
- });
60
+ return localizeDigits(
61
+ itemDate.toLocaleDateString(dateLocale(), {
62
+ month: "short",
63
+ day: "numeric",
64
+ year: "numeric",
65
+ })
66
+ );
68
67
  };
69
68
 
70
69
  /**
@@ -60,6 +60,7 @@ import { MessageEvents } from "../shared/events/messages";
60
60
  import { CometChatTextFormatter } from "../shared/formatters/CometChatTextFormatter";
61
61
  import { applyRawFormatters } from "../shared/formatters/applyRawFormatters";
62
62
  import { buildPinnedMessagesRequest } from "../shared/utils/PinnedMessagesHelper";
63
+ import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection } from "../shared/helper/layoutDirection";
63
64
  import { readListPage } from "../shared/offline/twoPhase";
64
65
  import { mediaActionSource, notifyMediaUnavailable } from "../shared/offline/media";
65
66
  import { useOfflineSessionEnded } from "../shared/offline/useOfflineSessionEnded";
@@ -111,6 +112,8 @@ const textOf = (message: CometChat.BaseMessage): string => {
111
112
  };
112
113
 
113
114
  export interface CometChatPinnedMessagesInterface {
115
+ /** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
116
+ layoutDirection?: "ltr" | "rtl";
114
117
  /** 1-1 conversation. Mutually exclusive with `group`. */
115
118
  user?: CometChat.User;
116
119
  /** Group conversation. Mutually exclusive with `user`. */
@@ -183,6 +186,8 @@ export const CometChatPinnedMessages = (props: CometChatPinnedMessagesInterface)
183
186
  title,
184
187
  style,
185
188
  } = props;
189
+ // ENG-41333: own setting → enclosing component → global; drives the root and the context.
190
+ const direction = useComponentLayoutDirection(props.layoutDirection);
186
191
 
187
192
  const theme = useTheme() as CometChatTheme;
188
193
  const compTheme = useCompTheme();
@@ -865,7 +870,8 @@ export const CometChatPinnedMessages = (props: CometChatPinnedMessagesInterface)
865
870
  };
866
871
 
867
872
  return (
868
- <View style={styles.containerStyle}>
873
+ <LayoutDirectionContext.Provider value={direction}>
874
+ <View style={[styles.containerStyle, directionStyle(direction)]}>
869
875
  {/* Back arrow LEADING the title, matching Group Info / User Info. This is a pushed
870
876
  full-screen route, not a modal, so a leading back is the right affordance — a
871
877
  trailing ✕ read as "dismiss a sheet". */}
@@ -1032,5 +1038,6 @@ export const CometChatPinnedMessages = (props: CometChatPinnedMessagesInterface)
1032
1038
 
1033
1039
  {ToastElement}
1034
1040
  </View>
1041
+ </LayoutDirectionContext.Provider>
1035
1042
  );
1036
1043
  };
@@ -67,13 +67,13 @@ export const getPinnedMessagesStyleLight = (
67
67
  flexDirection: "row",
68
68
  alignItems: "center",
69
69
  paddingTop: spacing.padding.p4,
70
- paddingLeft: spacing.padding.p2,
70
+ paddingStart: spacing.padding.p2,
71
71
  paddingBottom: spacing.padding.p2,
72
72
  },
73
73
  titleStyle: {
74
74
  ...typography.heading1.bold,
75
75
  color: color.textPrimary,
76
- paddingLeft: spacing.padding.p1,
76
+ paddingStart: spacing.padding.p1,
77
77
  },
78
78
  closeButtonIconStyle: {
79
79
  tintColor: color.iconPrimary,
@@ -115,7 +115,7 @@ export const getPinnedMessagesStyleLight = (
115
115
  senderNameStyle: {
116
116
  ...typography.body.medium,
117
117
  color: color.textHighlight,
118
- marginLeft: spacing.margin.m2,
118
+ marginStart: spacing.margin.m2,
119
119
  },
120
120
  separatorStyle: {
121
121
  ...typography.caption1.regular,
@@ -134,11 +134,11 @@ export const getPinnedMessagesStyleLight = (
134
134
  width: 14,
135
135
  },
136
136
  savedIndicatorContainerStyle: {
137
- marginLeft: spacing.margin.m1,
137
+ marginStart: spacing.margin.m1,
138
138
  },
139
139
  bubbleContainerStyle: {
140
140
  // Lines the bubble up under the sender name rather than the avatar.
141
- marginLeft: spacing.spacing.s10,
141
+ marginStart: spacing.spacing.s10,
142
142
  },
143
143
  },
144
144
  emptyStateStyle: {
@@ -85,6 +85,8 @@ type PasteMediaEventData = Readonly<{
85
85
 
86
86
  export interface NativeProps extends ViewProps {
87
87
  placeholder?: string;
88
+ /** ENG-41384: kit direction, for iOS (Android gets it from the layout). */
89
+ isRTL?: boolean;
88
90
  editable?: boolean;
89
91
  maxHeight?: Double;
90
92
  numberOfLines?: Int32;
@@ -10,6 +10,7 @@ import type {
10
10
  InlineStyleKey,
11
11
  } from './types';
12
12
  import RichTextEditorViewNative from './RichTextEditorViewNativeComponent';
13
+ import { useKitRTL } from '../shared/helper/layoutDirection';
13
14
 
14
15
  // Command constants
15
16
  const COMMANDS = {
@@ -145,6 +146,7 @@ export interface RichTextEditorPropsExtended extends RichTextEditorProps {
145
146
 
146
147
  const RichTextEditor = forwardRef<RichTextEditorRef, RichTextEditorPropsExtended>((props, ref) => {
147
148
  const nativeRef = useRef<React.ElementRef<typeof RichTextEditorViewNative>>(null);
149
+ const isRTL = useKitRTL(); // ENG-41384: the iOS editor needs the kit direction told to it.
148
150
  const [height, setHeight] = useState<number | undefined>(undefined);
149
151
  // Latest mention ranges reported by native, in plain-text coordinates. Native owns them
150
152
  // because editing shifts them; it re-reports on every content change.
@@ -386,6 +388,7 @@ const RichTextEditor = forwardRef<RichTextEditorRef, RichTextEditorPropsExtended
386
388
  accessibilityLabel={props.accessibilityLabel}
387
389
  style={combinedStyle}
388
390
  placeholder={props.placeholder}
391
+ isRTL={isRTL}
389
392
  initialContentJson={props.initialContent ? JSON.stringify(props.initialContent) : undefined}
390
393
  editable={props.readOnly !== undefined ? !props.readOnly : true}
391
394
  maxHeight={props.maxHeight}
@@ -68,6 +68,8 @@ import { CometChatUIEventHandler } from "../shared/events/CometChatUIEventHandle
68
68
  import { MessageEvents } from "../shared/events/messages";
69
69
  import { CometChatTextFormatter } from "../shared/formatters/CometChatTextFormatter";
70
70
  import { applyRawFormatters } from "../shared/formatters/applyRawFormatters";
71
+ import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection } from "../shared/helper/layoutDirection";
72
+ import { SenderLabel } from "../shared/views/SenderLabel";
71
73
  import { readListPage } from "../shared/offline/twoPhase";
72
74
  import { useOfflineSessionEnded } from "../shared/offline/useOfflineSessionEnded";
73
75
  import { useOfflineReconnect } from "../shared/offline/useOfflineReconnect";
@@ -83,6 +85,8 @@ import { CONTRACT_IDS } from "../shared/offline/stateContract";
83
85
  const savedRichTextFormatter = new CometChatRichTextFormatter();
84
86
 
85
87
  export interface CometChatSavedMessagesInterface {
88
+ /** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
89
+ layoutDirection?: "ltr" | "rtl";
86
90
  /** Page size. Defaults to 30; the server caps the whole set at 100. */
87
91
  limit?: number;
88
92
  /**
@@ -140,6 +144,8 @@ export const CometChatSavedMessages = (props: CometChatSavedMessagesInterface) =
140
144
  title,
141
145
  style,
142
146
  } = props;
147
+ // ENG-41333: own setting → enclosing component → global; drives the root and the context.
148
+ const direction = useComponentLayoutDirection(props.layoutDirection);
143
149
 
144
150
  const theme = useTheme() as CometChatTheme;
145
151
 
@@ -544,7 +550,6 @@ export const CometChatSavedMessages = (props: CometChatSavedMessagesInterface) =
544
550
  loggedInUser.current?.getUid() ?? null,
545
551
  t("YOU") ?? "You"
546
552
  );
547
- const prefix = prefixName ? `${prefixName}: ` : "";
548
553
 
549
554
  const rawLabel = preview.text ?? (preview.labelKey ? (t(preview.labelKey) ?? "") : "");
550
555
 
@@ -659,14 +664,8 @@ export const CometChatSavedMessages = (props: CometChatSavedMessagesInterface) =
659
664
 
660
665
  return (
661
666
  <View style={localStyles.subtitleRow}>
662
- {prefix ? (
663
- <Text
664
- numberOfLines={1}
665
- style={itemStyle?.subtitleStyle}
666
- >
667
- {prefix}
668
- </Text>
669
- ) : null}
667
+ {/* A long name ellipsizes at 40%, as in the conversation list; short ones keep full width. */}
668
+ <SenderLabel name={prefixName} textStyle={itemStyle?.subtitleStyle} containerStyle={LABEL_LIMIT} />
670
669
  {preview.icon ? (
671
670
  <Icon
672
671
  name={preview.icon as IconName}
@@ -734,7 +733,8 @@ export const CometChatSavedMessages = (props: CometChatSavedMessagesInterface) =
734
733
  };
735
734
 
736
735
  return (
737
- <View style={styles.containerStyle}>
736
+ <LayoutDirectionContext.Provider value={direction}>
737
+ <View style={[styles.containerStyle, directionStyle(direction)]}>
738
738
  {/* Back arrow LEADING the title, matching Group Info / User Info. This is a pushed
739
739
  full-screen route, not a modal, so a leading back is the right affordance — a
740
740
  trailing ✕ read as "dismiss a sheet". */}
@@ -869,6 +869,7 @@ export const CometChatSavedMessages = (props: CometChatSavedMessagesInterface) =
869
869
 
870
870
  {ToastElement}
871
871
  </View>
872
+ </LayoutDirectionContext.Provider>
872
873
  );
873
874
  };
874
875
 
@@ -876,6 +877,8 @@ export const CometChatSavedMessages = (props: CometChatSavedMessagesInterface) =
876
877
  * Static layout only — nothing here depends on the theme. Anything theme-derived
877
878
  * lives in ./style.ts (or conversationStyles, for the row chrome) and is merged in.
878
879
  */
880
+ const LABEL_LIMIT = { maxWidth: "40%" } as const;
881
+
879
882
  const localStyles = StyleSheet.create({
880
883
  // Block-preview styling, matching CometChatConversations so a saved row and a
881
884
  // conversation row render the same message identically.
@@ -908,7 +911,7 @@ const localStyles = StyleSheet.create({
908
911
  width: 3,
909
912
  borderRadius: 1.5,
910
913
  marginVertical: 3,
911
- marginLeft: 4,
914
+ marginStart: 4,
912
915
  },
913
916
  blockquoteText: {
914
917
  flex: 1,
@@ -63,13 +63,13 @@ export const getSavedMessagesStyleLight = (
63
63
  flexDirection: "row",
64
64
  alignItems: "center",
65
65
  paddingTop: spacing.padding.p4,
66
- paddingLeft: spacing.padding.p2,
66
+ paddingStart: spacing.padding.p2,
67
67
  paddingBottom: spacing.padding.p2,
68
68
  },
69
69
  titleStyle: {
70
70
  ...typography.heading1.bold,
71
71
  color: color.textPrimary,
72
- paddingLeft: spacing.padding.p1,
72
+ paddingStart: spacing.padding.p1,
73
73
  },
74
74
  closeButtonIconStyle: {
75
75
  tintColor: color.iconPrimary,
@@ -82,7 +82,7 @@ export const getSavedMessagesStyleLight = (
82
82
  width: spacing.spacing.s4,
83
83
  },
84
84
  previewIconContainerStyle: {
85
- marginRight: spacing.margin.m1,
85
+ marginEnd: spacing.margin.m1,
86
86
  },
87
87
  menuIconStyle: {
88
88
  tintColor: color.iconSecondary,