@cometchat/chat-uikit-react-native 5.5.4 → 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 (215) 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/FileManager.java +78 -3
  4. package/android/src/main/java/com/reactnativecometchatuikit/KeyboardDirectionWatcher.kt +64 -0
  5. package/android/src/main/java/com/reactnativecometchatuikit/KeyboardLanguageDirection.kt +44 -0
  6. package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +287 -49
  7. package/android/src/main/java/com/reactnativecometchatuikit/SafeFileName.java +78 -0
  8. package/ios/CCLocalFileGuard.h +19 -0
  9. package/ios/CCLocalFileGuard.m +34 -0
  10. package/ios/CometChatKeyboardModule.m +9 -0
  11. package/ios/CometChatKeyboardModule.swift +71 -0
  12. package/ios/FileManager.m +70 -6
  13. package/ios/KeyboardLanguageDirection.swift +24 -0
  14. package/ios/RichTextEditorView.swift +253 -51
  15. package/ios/RichTextEditorViewManager.m +1 -0
  16. package/ios/VideoManager.m +1 -1
  17. package/package.json +18 -3
  18. package/src/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.tsx +41 -57
  19. package/src/CometChatAIAssistantChatHistory/Skeleton.tsx +4 -1
  20. package/src/CometChatAIAssistantChatHistory/style.ts +5 -2
  21. package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +145 -63
  22. package/src/CometChatCompactMessageComposer/styles.ts +7 -7
  23. package/src/CometChatConversations/CometChatConversations.tsx +276 -147
  24. package/src/CometChatConversations/Skeleton.tsx +4 -1
  25. package/src/CometChatConversations/style.ts +1 -1
  26. package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +39 -18
  27. package/src/CometChatGroupMembers/Skeleton.tsx +4 -1
  28. package/src/CometChatGroupMembers/style.ts +6 -4
  29. package/src/CometChatGroups/CometChatGroups.tsx +74 -58
  30. package/src/CometChatGroups/GroupsStyle.ts +1 -1
  31. package/src/CometChatGroups/Skeleton.tsx +4 -1
  32. package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +190 -96
  33. package/src/CometChatMessageComposer/styles.tsx +1 -1
  34. package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +28 -15
  35. package/src/CometChatMessageHeader/listners.ts +76 -56
  36. package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +8 -1
  37. package/src/CometChatMessageInformation/Skeleton.tsx +4 -1
  38. package/src/CometChatMessageList/CometChatMessageList.tsx +1465 -313
  39. package/src/CometChatMessageList/SwipeToReplyView.tsx +61 -0
  40. package/src/CometChatMessageList/style.ts +32 -32
  41. package/src/CometChatMessageList/swipeToReply.ts +25 -0
  42. package/src/CometChatNotificationFeed/CometChatNotificationFeed.tsx +81 -10
  43. package/src/CometChatNotificationFeed/style.ts +1 -1
  44. package/src/CometChatNotificationFeed/utils.ts +17 -18
  45. package/src/CometChatPinnedMessages/CometChatPinnedMessages.tsx +82 -3
  46. package/src/CometChatPinnedMessages/style.ts +5 -5
  47. package/src/CometChatRichTextEditor/RichTextEditorViewNativeComponent.ts +2 -0
  48. package/src/CometChatRichTextEditor/index.tsx +3 -0
  49. package/src/CometChatSavedMessages/CometChatSavedMessages.tsx +83 -15
  50. package/src/CometChatSavedMessages/style.ts +3 -3
  51. package/src/CometChatSearch/CometChatSearch.tsx +391 -136
  52. package/src/CometChatSearch/Skeleton.tsx +4 -1
  53. package/src/CometChatSearch/searchLabels.ts +26 -0
  54. package/src/CometChatSearch/style.ts +7 -7
  55. package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +34 -8
  56. package/src/CometChatThreadHeader/Header.tsx +2 -2
  57. package/src/CometChatUsers/CometChatUsers.tsx +10 -1
  58. package/src/CometChatUsers/Skeleton.tsx +4 -1
  59. package/src/CometChatUsers/style.ts +1 -1
  60. package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +27 -1
  61. package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +16 -4
  62. package/src/calls/CometChatCallLogs/Skeleton.tsx +4 -1
  63. package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +11 -3
  64. package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +10 -2
  65. package/src/extensions/CollaborativeBubble/style.ts +4 -4
  66. package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +1 -1
  67. package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +1 -1
  68. package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +11 -6
  69. package/src/extensions/LinkPreview/style.ts +6 -6
  70. package/src/extensions/Polls/Header.tsx +1 -1
  71. package/src/extensions/Polls/Polls.tsx +25 -12
  72. package/src/extensions/Polls/PollsBubble.tsx +10 -6
  73. package/src/extensions/Polls/style.ts +4 -4
  74. package/src/extensions/Stickers/CometChatStickerKeyboard/CometChatStickerKeyboard.tsx +2 -2
  75. package/src/extensions/Stickers/CometChatStickerKeyboard/Skeleton.tsx +1 -1
  76. package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +1 -1
  77. package/src/extensions/Stickers/StickersExtensionDecorator.tsx +4 -2
  78. package/src/index.ts +11 -1
  79. package/src/shared/CometChatUiKit/CometChatUIKit.ts +102 -2
  80. package/src/shared/CometChatUiKit/UIKitSettings.ts +28 -0
  81. package/src/shared/events/CometChatUIEventHandler/Listener.ts +10 -0
  82. package/src/shared/events/index.ts +4 -0
  83. package/src/shared/events/offline.ts +28 -0
  84. package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +18 -13
  85. package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +15 -7
  86. package/src/shared/formatters/CometChatTextFormatter.ts +11 -0
  87. package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +7 -4
  88. package/src/shared/framework/MessageDataSource.tsx +51 -108
  89. package/src/shared/helper/LocalizedDateHelper.ts +64 -4
  90. package/src/shared/helper/helperFunctions.ts +71 -4
  91. package/src/shared/helper/keyboardDirection.ts +54 -0
  92. package/src/shared/helper/layoutDirection.ts +205 -0
  93. package/src/shared/helper/pluralRules.ts +67 -0
  94. package/src/shared/helper/textDirection.ts +118 -0
  95. package/src/shared/icons/Icon.tsx +37 -2
  96. package/src/shared/icons/components/format-list-numbered-rtl.tsx +15 -0
  97. package/src/shared/index.ts +2 -0
  98. package/src/shared/offline/OfflineHub.ts +651 -0
  99. package/src/shared/offline/OfflineMediaBubble.tsx +49 -0
  100. package/src/shared/offline/OfflineViews.tsx +222 -0
  101. package/src/shared/offline/conversationPins.ts +137 -0
  102. package/src/shared/offline/conversations.ts +325 -0
  103. package/src/shared/offline/frameProbe.ts +24 -0
  104. package/src/shared/offline/gate.ts +94 -0
  105. package/src/shared/offline/groupActions.ts +81 -0
  106. package/src/shared/offline/identity.ts +162 -0
  107. package/src/shared/offline/index.ts +76 -0
  108. package/src/shared/offline/media.ts +247 -0
  109. package/src/shared/offline/notices.ts +84 -0
  110. package/src/shared/offline/reconcile.ts +296 -0
  111. package/src/shared/offline/searchOutcome.ts +62 -0
  112. package/src/shared/offline/send.ts +430 -0
  113. package/src/shared/offline/stateContract.ts +85 -0
  114. package/src/shared/offline/threadReplies.ts +125 -0
  115. package/src/shared/offline/twoPhase.ts +372 -0
  116. package/src/shared/offline/unsentActions.ts +168 -0
  117. package/src/shared/offline/useOfflineMediaUri.ts +87 -0
  118. package/src/shared/offline/useOfflineReconnect.ts +25 -0
  119. package/src/shared/offline/useOfflineSessionEnded.ts +22 -0
  120. package/src/shared/offline/useOfflineUploadTray.ts +76 -0
  121. package/src/shared/offline/usePresenceHidden.ts +33 -0
  122. package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +2 -0
  123. package/src/shared/resources/CometChatLocalizeNew/resources/ar/translation.json +720 -0
  124. package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +74 -3
  125. package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +75 -4
  126. package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +74 -3
  127. package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +75 -4
  128. package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +74 -3
  129. package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +74 -3
  130. package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +74 -3
  131. package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +74 -3
  132. package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +74 -3
  133. package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +82 -3
  134. package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +74 -3
  135. package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +74 -3
  136. package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +74 -3
  137. package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +90 -3
  138. package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +74 -3
  139. package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +74 -3
  140. package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +74 -3
  141. package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +74 -3
  142. package/src/shared/services/UploadQueueService.ts +106 -1
  143. package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +13 -12
  144. package/src/shared/utils/CometChatMessagePreview/style.ts +1 -1
  145. package/src/shared/utils/MessageReceiptUtils.ts +8 -0
  146. package/src/shared/utils/MessageUtils.tsx +14 -14
  147. package/src/shared/utils/PermissionUtil.ts +16 -5
  148. package/src/shared/utils/SavedMessagesHelper.ts +18 -1
  149. package/src/shared/utils/attachmentLimits.ts +3 -2
  150. package/src/shared/utils/catchUpCursor.ts +36 -0
  151. package/src/shared/utils/conversationUtils.ts +3 -5
  152. package/src/shared/utils/failedMessageRetry.ts +73 -0
  153. package/src/shared/utils/fileIconFontSize.ts +10 -0
  154. package/src/shared/utils/fileSizeLabel.ts +16 -0
  155. package/src/shared/utils/groupActionText.ts +75 -0
  156. package/src/shared/utils/messageIdentity.ts +38 -0
  157. package/src/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.tsx +12 -8
  158. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreview.style.ts +1 -1
  159. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreviewItem.tsx +5 -3
  160. package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTile.tsx +22 -17
  161. package/src/shared/views/CometChatAttachmentViewer/CometChatAttachmentViewer.tsx +45 -12
  162. package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +16 -10
  163. package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +20 -8
  164. package/src/shared/views/CometChatBadge/CometChatBadge.tsx +8 -4
  165. package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +6 -2
  166. package/src/shared/views/CometChatComposerErrorBanner.tsx +3 -1
  167. package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +8 -3
  168. package/src/shared/views/CometChatConversationStarter/CometChatConversationStarter.tsx +2 -2
  169. package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +5 -3
  170. package/src/shared/views/CometChatEmojiKeyboard/emojis.ts +8 -8
  171. package/src/shared/views/CometChatEmojiKeyboard/style.ts +2 -2
  172. package/src/shared/views/CometChatFileBubble/CometChatFileBubble.tsx +13 -27
  173. package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +65 -15
  174. package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +7 -3
  175. package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +56 -25
  176. package/src/shared/views/CometChatInlineAudioRecorder/CometChatInlineAudioRecorder.tsx +41 -21
  177. package/src/shared/views/CometChatInlineAudioRecorder/useAudioRecorder.ts +7 -3
  178. package/src/shared/views/CometChatLinkConfirmPopup/CometChatLinkConfirmPopup.tsx +7 -3
  179. package/src/shared/views/CometChatList/CometChatList.tsx +478 -21
  180. package/src/shared/views/CometChatList/Header.tsx +5 -2
  181. package/src/shared/views/CometChatList/sectionLetter.ts +44 -0
  182. package/src/shared/views/CometChatList/styles.ts +7 -7
  183. package/src/shared/views/CometChatListItem/CometChatListItem.tsx +6 -4
  184. package/src/shared/views/CometChatMediaRecorder/CometChatAudioPlayer.tsx +16 -10
  185. package/src/shared/views/CometChatMediaRecorder/Timer.tsx +5 -1
  186. package/src/shared/views/CometChatMediaViewer/CometChatMediaViewer.tsx +43 -16
  187. package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +24 -4
  188. package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +19 -2
  189. package/src/shared/views/CometChatNewMessageIndicator/CometChatNewMessageIndicator.tsx +3 -2
  190. package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +59 -12
  191. package/src/shared/views/CometChatReactionList/ReactionListStyle.tsx +2 -2
  192. package/src/shared/views/CometChatReactionList/Skeleton.tsx +4 -1
  193. package/src/shared/views/CometChatReactions/CometChatReactions.tsx +6 -2
  194. package/src/shared/views/CometChatReportDialog/CometChatReportDialog.tsx +7 -3
  195. package/src/shared/views/CometChatReportDialog/style.ts +1 -1
  196. package/src/shared/views/CometChatSmartReplies/CometChatSmartReplies.tsx +1 -1
  197. package/src/shared/views/CometChatStatusIndicator/CometChatStatusIndicator.tsx +4 -0
  198. package/src/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.tsx +20 -13
  199. package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +3 -2
  200. package/src/shared/views/CometChatSuggestionList/Skeleton.tsx +1 -1
  201. package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +29 -3
  202. package/src/shared/views/CometChatTooltipMenu/CometChatTooltipMenu.tsx +20 -30
  203. package/src/shared/views/CometChatTooltipMenu/tooltipPosition.ts +43 -0
  204. package/src/shared/views/CometChatVideoBubble/style.ts +2 -2
  205. package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +4 -1
  206. package/src/shared/views/CometChatVideosBubble/CometChatVideosBubble.tsx +58 -24
  207. package/src/shared/views/CometChatVoiceNoteBubble/CometChatVoiceNoteBubble.tsx +24 -12
  208. package/src/shared/views/SenderLabel.tsx +41 -0
  209. package/src/theme/default/default.ts +1 -1
  210. package/src/theme/type.ts +17 -0
  211. package/android/.gradle/7.4/checksums/checksums.lock +0 -0
  212. package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
  213. package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
  214. package/android/.gradle/7.4/gc.properties +0 -0
  215. package/android/.gradle/vcs-1/gc.properties +0 -0
@@ -17,6 +17,7 @@ import Svg, { Defs, G, LinearGradient, Path, Stop } from "react-native-svg";
17
17
 
18
18
  import { useTheme } from "@cometchat/chat-uikit-react-native";
19
19
  import { CometChatTheme } from "@cometchat/chat-uikit-react-native/src/theme/type";
20
+ import { useRtlMirror } from "../shared/helper/layoutDirection";
20
21
 
21
22
  // ───────────────────────────────────────────────────────────────
22
23
  // Consts & Types
@@ -118,6 +119,8 @@ const SkeletonItemTop: React.FC<SkeletonProps> = ({ style }) => {
118
119
  // ───────────────────────────────────────────────────────────────
119
120
  export const Skeleton: React.FC<SkeletonProps> = ({ style }) => {
120
121
  const theme = useTheme();
122
+ // ENG-41390: SVG shapes and the shimmer use fixed x positions; flip the whole skeleton in RTL.
123
+ const rtlMirror = useRtlMirror();
121
124
  const animatedValue = useRef(new Animated.Value(0)).current;
122
125
 
123
126
  /* Kick-off the shimmer animation once on mount */
@@ -141,7 +144,7 @@ export const Skeleton: React.FC<SkeletonProps> = ({ style }) => {
141
144
 
142
145
  /* Render ----------------------------------------------------- */
143
146
  return (
144
- <ScrollView showsVerticalScrollIndicator={false} scrollEnabled={false}>
147
+ <ScrollView style={rtlMirror} showsVerticalScrollIndicator={false} scrollEnabled={false}>
145
148
  {/* Bottom layer rectangles */}
146
149
  {Array.from({ length: SKELETON_ROW_COUNT }, (_, i) => (
147
150
  <SkeletonItemBottom style={style} key={`bottom-${i}`} />
@@ -0,0 +1,26 @@
1
+ import { getCometChatTranslation, getCurrentLanguage } from "../shared/resources/CometChatLocalizeNew/LocalizationManager";
2
+ import { LocalizedDateHelper, localizedDateHelperInstance } from "../shared/helper/LocalizedDateHelper";
3
+ import { pluralCountLabel } from "../shared/helper/pluralRules";
4
+
5
+ const t = getCometChatTranslation();
6
+
7
+ // ENG-57308: labels the search results list builds from a media message, in the kit language.
8
+ const COUNT_KEY: Record<string, string> = {
9
+ image: "SEARCH_IMAGE_COUNT",
10
+ video: "SEARCH_VIDEO_COUNT",
11
+ audio: "SEARCH_AUDIO_COUNT",
12
+ };
13
+
14
+ /** "4 Images" / "٤ صور" / "12 Files"; any type other than image, video or audio counts as files. */
15
+ export function mediaCountLabel(type: string, count: number): string {
16
+ return pluralCountLabel(t, COUNT_KEY[type] ?? "SEARCH_FILE_COUNT", count);
17
+ }
18
+
19
+ /** Month header over photo / video results: "November 2026" / "نوفمبر ٢٠٢٦". sentAt is in seconds. */
20
+ export function monthHeaderLabel(timestamp: number): string {
21
+ return localizedDateHelperInstance.getFormattedDate(
22
+ timestamp * 1000,
23
+ LocalizedDateHelper.patterns.monthYear,
24
+ getCurrentLanguage()
25
+ );
26
+ }
@@ -113,7 +113,7 @@ export const getSearchStyleLight = (
113
113
  height: spacing.spacing.s10,
114
114
  justifyContent: "center",
115
115
  alignItems: "center",
116
- marginRight: spacing.margin.m2,
116
+ marginEnd: spacing.margin.m2,
117
117
  },
118
118
  backButtonIconStyle: {
119
119
  tintColor: color.iconSecondary,
@@ -149,7 +149,7 @@ export const getSearchStyleLight = (
149
149
  height: spacing.spacing.s6,
150
150
  justifyContent: "center",
151
151
  alignItems: "center",
152
- marginLeft: spacing.margin.m2,
152
+ marginStart: spacing.margin.m2,
153
153
  },
154
154
  clearButtonIconStyle: {
155
155
  tintColor: color.iconSecondary,
@@ -169,7 +169,7 @@ export const getSearchStyleLight = (
169
169
  filterButtonStyle: {
170
170
  paddingHorizontal: spacing.padding.p3,
171
171
  paddingVertical: spacing.padding.p2,
172
- marginRight: spacing.margin.m2,
172
+ marginEnd: spacing.margin.m2,
173
173
  marginBottom: spacing.margin.m2,
174
174
  backgroundColor: color.background3,
175
175
  borderRadius: spacing.radius.r5,
@@ -269,7 +269,7 @@ export const getSearchStyleLight = (
269
269
  },
270
270
  contentStyle: {
271
271
  flex: 1,
272
- marginLeft: spacing.margin.m3,
272
+ marginStart: spacing.margin.m3,
273
273
  },
274
274
  titleStyle: {
275
275
  ...typography.heading4.medium,
@@ -284,7 +284,7 @@ export const getSearchStyleLight = (
284
284
  trailingContainerStyle: {
285
285
  alignItems: "flex-end",
286
286
  justifyContent: "flex-start",
287
- marginLeft: spacing.margin.m2,
287
+ marginStart: spacing.margin.m2,
288
288
  minHeight: spacing.spacing.s12,
289
289
  },
290
290
  badgeStyle: {
@@ -329,14 +329,14 @@ export const getSearchStyleLight = (
329
329
  width: '90%',
330
330
  },
331
331
  iconContainerStyle: {
332
- marginRight: spacing.margin.m3,
332
+ marginEnd: spacing.margin.m3,
333
333
  alignItems: "center",
334
334
  justifyContent: "center",
335
335
  },
336
336
  trailingContainerStyle: {
337
337
  alignItems: "flex-end",
338
338
  justifyContent: "flex-start",
339
- marginLeft: spacing.margin.m2,
339
+ marginStart: spacing.margin.m2,
340
340
  minHeight: spacing.spacing.s12,
341
341
  },
342
342
  previewContainerStyle: {
@@ -23,6 +23,10 @@ import { useCometChatTranslation } from "../shared/resources/CometChatLocalizeNe
23
23
  import { ExtensionConstants } from "../extensions";
24
24
  import { getExtensionData } from "../shared/helper/functions";
25
25
  import { urlPattern } from "../shared/constants/UIKitConstants";
26
+ import { pluralCountLabel } from "../shared/helper/pluralRules";
27
+ import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection } from "../shared/helper/layoutDirection";
28
+ import { OfflineHub } from "../shared/offline/OfflineHub";
29
+ import { createThreadReplyTracker } from "../shared/offline/threadReplies";
26
30
 
27
31
  /**
28
32
  * Unique UI event identifier for CometChatUIEventHandler.
@@ -35,6 +39,8 @@ const uiEventId = "ccUiEvent" + Date.now() + "_" + (++__listenerIdCounter);
35
39
  * @interface CometChatThreadHeaderInterface
36
40
  */
37
41
  export interface CometChatThreadHeaderInterface {
42
+ /** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
43
+ layoutDirection?: "ltr" | "rtl";
38
44
  /**
39
45
  * The parent message for the thread. It is a CometChat BaseMessage object.
40
46
  *
@@ -127,11 +133,24 @@ export const CometChatThreadHeader = (props: CometChatThreadHeaderInterface): JS
127
133
  avatarVisibility = true,
128
134
  TrailingView,
129
135
  } = props;
136
+ // ENG-41333: own setting → enclosing component → global; drives the root and the context.
137
+ const direction = useComponentLayoutDirection(props.layoutDirection);
130
138
  const [message, setMessage] = useState<CometChat.BaseMessage>(parentMessage);
131
139
  const [replyCount, setReplyCount] = useState<number>(parentMessage.getReplyCount() || 0);
140
+ // Offline (ON path) reply-count adjustments (README §3.9); inert with offline off.
141
+ const parentIdRef = React.useRef<any>(parentMessage.getId());
142
+ parentIdRef.current = message.getId();
143
+ const replyTracker = React.useRef(
144
+ createThreadReplyTracker(
145
+ () => parentIdRef.current,
146
+ () => OfflineHub.getInstance().gen,
147
+ (delta) => setReplyCount((prev) => Math.max(0, prev + delta)),
148
+ (count) => setReplyCount(count)
149
+ )
150
+ );
132
151
 
133
152
  const theme = useTheme();
134
- const { t } = useCometChatTranslation();
153
+ const { t, language } = useCometChatTranslation();
135
154
  const style = useMemo(() => deepMerge(theme.threadHeaderStyles, props.style ?? {}), [theme, props.style]);
136
155
 
137
156
  /**
@@ -161,8 +180,11 @@ export const CometChatThreadHeader = (props: CometChatThreadHeaderInterface): JS
161
180
  * @param {{ message: CometChat.BaseMessage, status: string }} param0 - The message and its status.
162
181
  */
163
182
  const ccMessageSentFunc = ({ message: msg, status }: any): void => {
183
+ // Offline (ON path): an own reply is counted once, at its pending; its ack adds nothing.
184
+ replyTracker.current.onPublicSent(msg, status, () => {
185
+ if (status === messageStatus.success) checkAndUpdateRepliesCount(msg);
186
+ });
164
187
  if (status === messageStatus.success) {
165
- checkAndUpdateRepliesCount(msg);
166
188
  if (message.getId() == msg.id) setMessage(message);
167
189
  }
168
190
  };
@@ -243,8 +265,14 @@ export const CometChatThreadHeader = (props: CometChatThreadHeaderInterface): JS
243
265
  },
244
266
  });
245
267
 
268
+ const hub = OfflineHub.getInstance();
269
+ const sendStates = hub.sendState$.subscribe((event) => replyTracker.current.onSendState(event));
270
+ const updates = hub.messagesUpdated$.subscribe((event) => replyTracker.current.onMessagesUpdated(event));
271
+
246
272
  return () => {
247
273
  CometChatUIEventHandler.removeMessageListener(uiEventId);
274
+ sendStates.unsubscribe();
275
+ updates.unsubscribe();
248
276
  };
249
277
  }, []);
250
278
 
@@ -268,7 +296,8 @@ export const CometChatThreadHeader = (props: CometChatThreadHeaderInterface): JS
268
296
  }, [message]);
269
297
 
270
298
  return (
271
- <View style={[style?.containerStyle]}>
299
+ <LayoutDirectionContext.Provider value={direction}>
300
+ <View style={[style?.containerStyle, directionStyle(direction)]}>
272
301
  <ScrollView style={style?.messageBubbleContainerStyle}>
273
302
  <View pointerEvents={hasUrl ? 'auto' : 'none'}>
274
303
  {MessageUtils.getMessageView({
@@ -295,16 +324,13 @@ export const CometChatThreadHeader = (props: CometChatThreadHeaderInterface): JS
295
324
  {replyCountBarVisibility && (
296
325
  <View style={[style?.replyCountBarStyle, staticStyles.replyCountBarRow]}>
297
326
  <Text style={style?.replyCountTextStyle}>
298
- {replyCountVisibility
299
- ? replyCount.toString() +
300
- " " +
301
- (replyCount == 1 ? t("REPLY") : t("REPLIES"))
302
- : ""}
327
+ {replyCountVisibility ? pluralCountLabel(t, "REPLY_COUNT", replyCount, language) : ""}
303
328
  </Text>
304
329
  {TrailingView && <TrailingView parentMessage={message} />}
305
330
  </View>
306
331
  )}
307
332
  </View>
333
+ </LayoutDirectionContext.Provider>
308
334
  );
309
335
  };
310
336
 
@@ -39,9 +39,9 @@ const styles = StyleSheet.create({
39
39
  flexDirection: "row",
40
40
  alignItems: "center",
41
41
  height: 56,
42
- paddingLeft: 15,
42
+ paddingStart: 15,
43
43
  },
44
- iconContainer: { paddingRight: 25, alignItems: "center" },
44
+ iconContainer: { paddingEnd: 25, alignItems: "center" },
45
45
  headingText: { fontSize: 20, fontWeight: "600", color: "#000" },
46
46
  });
47
47
  export default Header;
@@ -20,6 +20,7 @@ import { UserStyle } from "./style";
20
20
  import { CommonUtils } from "../shared/utils/CommonUtils";
21
21
  import { CometChatTooltipMenu } from "../shared/views/CometChatTooltipMenu";
22
22
  import { useCometChatTranslation } from "../shared/resources/CometChatLocalizeNew";
23
+ import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection } from "../shared/helper/layoutDirection";
23
24
 
24
25
  /**
25
26
  * Interface for the menu items (tooltip actions).
@@ -63,6 +64,8 @@ export interface CometChatUsersInterface
63
64
  | "errorStateText"
64
65
  | "hideStickyHeader"
65
66
  > {
67
+ /** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
68
+ layoutDirection?: "ltr" | "rtl";
66
69
  /**
67
70
  * Callback function when a list item (user) is pressed.
68
71
  *
@@ -263,6 +266,8 @@ export const CometChatUsers = React.forwardRef<
263
266
  searchPlaceholderText = t("SEARCH"),
264
267
  ...newProps
265
268
  } = props;
269
+ // ENG-41333: own setting → enclosing component → global; drives the root and the context.
270
+ const direction = useComponentLayoutDirection(props.layoutDirection);
266
271
  const userRef = useRef<CometChatUsersActionsInterface>(null);
267
272
  const mergedStyle = useMemo(() => deepMerge(theme.userStyles, style), [theme, style]);
268
273
 
@@ -477,7 +482,8 @@ export const CometChatUsers = React.forwardRef<
477
482
  );
478
483
 
479
484
  return (
480
- <View style={theme.userStyles.containerStyle}>
485
+ <LayoutDirectionContext.Provider value={direction}>
486
+ <View style={[theme.userStyles.containerStyle, directionStyle(direction)]}>
481
487
  <CometChatList
482
488
  hideHeader={hideHeader ?? hideHeader}
483
489
  searchPlaceholderText={searchPlaceholderText}
@@ -510,7 +516,9 @@ export const CometChatUsers = React.forwardRef<
510
516
  : () => <Skeleton style={mergedStyle.skeletonStyle} />
511
517
  }
512
518
  EmptyView={EmptyView ? EmptyView : () => <EmptyStateView />}
519
+ customEmptyView={!!EmptyView}
513
520
  ErrorView={ErrorView ? ErrorView : () => <ErrorStateView />}
521
+ customErrorView={!!ErrorView}
514
522
  statusIndicatorType={(user: CometChat.User) =>
515
523
  usersStatusVisibility
516
524
  ? user?.getBlockedByMe()
@@ -543,5 +551,6 @@ export const CometChatUsers = React.forwardRef<
543
551
  </View>
544
552
  )}
545
553
  </View>
554
+ </LayoutDirectionContext.Provider>
546
555
  );
547
556
  });
@@ -4,6 +4,7 @@ import Svg, { Circle, Defs, LinearGradient, Rect, Stop } from "react-native-svg"
4
4
  import { useTheme } from "../theme";
5
5
  import type { ColorValue } from "react-native";
6
6
  import { CometChatTheme } from "../theme/type";
7
+ import { useRtlMirror } from "../shared/helper/layoutDirection";
7
8
 
8
9
  /**
9
10
  * Animated skeleton placeholder mimicking a *user list* in CometChat UI‑Kit.
@@ -97,6 +98,8 @@ const useRows = (fill: ColorValue) =>
97
98
 
98
99
  export const Skeleton: React.FC<SkeletonProps> = ({ style }) => {
99
100
  const theme = useTheme();
101
+ // ENG-41390: SVG shapes and the shimmer use fixed x positions; flip the whole skeleton in RTL.
102
+ const rtlMirror = useRtlMirror();
100
103
  const get = <K extends keyof SkeletonStyle>(key: K) => getStyleValue(key, style, theme);
101
104
 
102
105
  // Shimmer animation ------------------------------------------
@@ -131,7 +134,7 @@ export const Skeleton: React.FC<SkeletonProps> = ({ style }) => {
131
134
  <ScrollView
132
135
  scrollEnabled={false}
133
136
  showsVerticalScrollIndicator={false}
134
- style={{ backgroundColor: get("containerBackgroundColor") }}
137
+ style={[{ backgroundColor: get("containerBackgroundColor") }, rtlMirror]}
135
138
  >
136
139
  {/* Bottom layer (gradient fill) */}
137
140
  <Svg
@@ -79,7 +79,7 @@ export const getUserListStyleLight = (
79
79
  onlineStatusColor: color.success,
80
80
  titleViewStyle: {
81
81
  paddingVertical: spacing.spacing.s3,
82
- paddingLeft: spacing.spacing.s3,
82
+ paddingStart: spacing.spacing.s3,
83
83
  margin: spacing.spacing.s0,
84
84
  },
85
85
  titleStyle: {
@@ -24,7 +24,10 @@ import { CometChatOutgoingCall, OutgoingCallConfiguration } from "../CometChatOu
24
24
  import { CallButtonStyle } from "./style";
25
25
  import { DeepPartial } from "../../shared/helper/types";
26
26
  import { CallingPackage } from "../CallingPackage";
27
+ import { isQuietRejection } from "../../shared/offline/send";
28
+ import { isOfflineOn, sdkConnected } from "../../shared/offline/gate";
27
29
  import { JSX } from "react";
30
+ import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection } from "../../shared/helper/layoutDirection";
28
31
 
29
32
  const CometChatCalls = CallingPackage.CometChatCalls;
30
33
 
@@ -36,6 +39,8 @@ const listenerId = "callEventListener_" + Date.now() + "_" + (++__listenerIdCoun
36
39
  * @interface CometChatCallButtonsInterface
37
40
  */
38
41
  export interface CometChatCallButtonsInterface {
42
+ /** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
43
+ layoutDirection?: "ltr" | "rtl";
39
44
  /**
40
45
  * CometChat.User object.
41
46
  */
@@ -101,6 +106,8 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface): JSX.
101
106
  outgoingCallConfiguration,
102
107
  style = {},
103
108
  } = props;
109
+ // ENG-41333: own setting → enclosing component → global; drives the root and the context.
110
+ const direction = useComponentLayoutDirection(props.layoutDirection);
104
111
 
105
112
  const theme = useTheme();
106
113
  const compTheme = useCompTheme();
@@ -142,6 +149,22 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface): JSX.
142
149
  var callType = type;
143
150
  // For group calls, send a custom meeting message.
144
151
  if (group) {
152
+ // A call invite is worth nothing once it is late, so it never joins the offline queue.
153
+ // Queued, the send stays unanswered until the connection returns, and the `.then` below
154
+ // would then open the outgoing-call screen and invite the whole group minutes after the
155
+ // tap, with a push, without the user asking. Refuse it now instead, the way a refused
156
+ // `initiateCall` is refused. (Android 6.3.0 queues it - parity gap recorded on purpose.)
157
+ if (isOfflineOn() && sdkConnected() === false) {
158
+ const offlineError = new CometChat.CometChatException({
159
+ code: "ERROR_NO_INTERNET",
160
+ name: "ERROR_NO_INTERNET",
161
+ message: "A call cannot be started without a connection.",
162
+ });
163
+ // `{ error }`, the shape the kit's own `ccCallFailed` listener takes (CometChatOutgoingCall.tsx:198).
164
+ CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccCallFailed, { error: offlineError });
165
+ onError && onError(offlineError);
166
+ return;
167
+ }
145
168
  let customData = {
146
169
  callType: callType,
147
170
  sessionId: receiverID,
@@ -171,6 +194,7 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface): JSX.
171
194
  CometChatUIEventHandler.emitCallEvent(CallUIEvents.ccOutgoingCall, { call: res });
172
195
  })
173
196
  .catch((rej) => {
197
+ if (isQuietRejection(rej)) return; // the session ended or the cache was reset: nothing to report
174
198
  console.log("custom msg error", rej);
175
199
  onError && onError(rej);
176
200
  });
@@ -296,7 +320,8 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface): JSX.
296
320
  }, []);
297
321
 
298
322
  return (
299
- <View style={callButtonStyles.containerStyle as ViewStyle}>
323
+ <LayoutDirectionContext.Provider value={direction}>
324
+ <View style={[callButtonStyles.containerStyle as ViewStyle, directionStyle(direction)]}>
300
325
  {!hideVoiceCallButton && (
301
326
  <TouchableOpacity onPress={() => makeVoiceCall()}>
302
327
  <Icon
@@ -351,5 +376,6 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface): JSX.
351
376
  />
352
377
  )}
353
378
  </View>
379
+ </LayoutDirectionContext.Provider>
354
380
  );
355
381
  };
@@ -30,6 +30,8 @@ import { DeepPartial, ValueOf } from "../../shared/helper/types";
30
30
  import { CometChatTooltipMenu, MenuItemInterface } from "../../shared/views/CometChatTooltipMenu";
31
31
  import { JSX } from "react";
32
32
  import { useCometChatTranslation, useLocalizedDate, LocalizedDateHelper } from "../../shared";
33
+ import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection, TEXT_START } from "../../shared/helper/layoutDirection";
34
+ import { stripBidiControls } from "../../shared/helper/textDirection";
33
35
 
34
36
  const listenerId = "callEventListener_" + Date.now() + "_" + (++__listenerIdCounter);
35
37
  const CometChatCalls = CallingPackage.CometChatCalls;
@@ -40,6 +42,8 @@ const CometChatCalls = CallingPackage.CometChatCalls;
40
42
  * @interface CometChatCallLogsConfigurationInterface
41
43
  */
42
44
  export interface CometChatCallLogsConfigurationInterface {
45
+ /** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
46
+ layoutDirection?: "ltr" | "rtl";
43
47
  /** Custom component to render as the leading view for each call log item */
44
48
  LeadingView?: (call?: any) => JSX.Element;
45
49
  /** Custom component to render as the title view for each call log item */
@@ -139,6 +143,8 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
139
143
  addOptions,
140
144
  options,
141
145
  } = props;
146
+ // ENG-41333: own setting → enclosing component → global; drives the root and the context.
147
+ const direction = useComponentLayoutDirection(props.layoutDirection);
142
148
 
143
149
  const [list, setList] = useState<any[]>([]);
144
150
  const [listState, setListState] = useState<"loading" | "error" | "done">("loading");
@@ -429,19 +435,22 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
429
435
  }}
430
436
  />
431
437
  )}
432
- <View>
438
+ {/* flex: 1 pushes the call button to the end edge in LTR and RTL; a
439
+ marginStart: "auto" on the TouchableOpacity alone did not under per-view RTL. */}
440
+ <View style={{ flex: 1 }}>
433
441
  {TitleView ? (
434
442
  TitleView(item)
435
443
  ) : (
436
444
  <Text
437
445
  style={[
446
+ TEXT_START,
438
447
  mergedCallLogsStyle.itemStyle.titleTextStyle,
439
448
  callStatus === "missed"
440
449
  ? mergedCallLogsStyle.itemStyle.missedCallTitleTextStyle
441
450
  : {},
442
451
  ]}
443
452
  >
444
- {title}
453
+ {stripBidiControls(title)}
445
454
  </Text>
446
455
  )}
447
456
  <View style={{ flexDirection: "row", alignItems: "center", gap: 4 }}>
@@ -466,7 +475,7 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
466
475
  {SubtitleView ? (
467
476
  SubtitleView(item)
468
477
  ) : (
469
- <Text style={mergedCallLogsStyle.itemStyle.subTitleTextStyle}>
478
+ <Text style={[TEXT_START, mergedCallLogsStyle.itemStyle.subTitleTextStyle]}>
470
479
  {formatDate(
471
480
  item["initiatedAt"] * 1000,
472
481
  datePattern ?? LocalizedDateHelper.patterns.callLogs
@@ -481,7 +490,7 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
481
490
  <TouchableOpacity
482
491
  onPress={() => onPress(item)}
483
492
  style={{
484
- marginLeft: "auto",
493
+ marginStart: "auto",
485
494
  }}
486
495
  >
487
496
  <Icon
@@ -567,8 +576,10 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
567
576
  }, [theme, listState]);
568
577
 
569
578
  return (
579
+ <LayoutDirectionContext.Provider value={direction}>
570
580
  <View
571
581
  style={{
582
+ ...directionStyle(direction),
572
583
  backgroundColor: theme.color.background1,
573
584
  height: "100%",
574
585
  width: "100%",
@@ -682,5 +693,6 @@ export const CometChatCallLogs = (props: CometChatCallLogsConfigurationInterface
682
693
  )}
683
694
  {/* End tooltip menu */}
684
695
  </View>
696
+ </LayoutDirectionContext.Provider>
685
697
  );
686
698
  };
@@ -30,6 +30,7 @@ import Svg, {
30
30
  } from "react-native-svg";
31
31
  import { useTheme } from "../../theme";
32
32
  import { CometChatTheme } from "../../theme/type";
33
+ import { useRtlMirror } from "../../shared/helper/layoutDirection";
33
34
 
34
35
  const { width: screenWidth } = Dimensions.get("window");
35
36
 
@@ -145,6 +146,8 @@ const SkeletonItemTop: React.FC<SkeletonProps> = ({ style = {} }) => {
145
146
  */
146
147
  export const Skeleton: React.FC<SkeletonProps> = ({ style = {} }) => {
147
148
  const theme = useTheme();
149
+ // ENG-41390: SVG shapes and the shimmer use fixed x positions; flip the whole skeleton in RTL.
150
+ const rtlMirror = useRtlMirror();
148
151
  const defaults = theme.callLogsStyles.skeletonStyle;
149
152
 
150
153
  /* guaranteed speed */
@@ -177,7 +180,7 @@ export const Skeleton: React.FC<SkeletonProps> = ({ style = {} }) => {
177
180
  /* Render */
178
181
  /* ------------------------------------------------------------------ */
179
182
  return (
180
- <ScrollView showsVerticalScrollIndicator={false} scrollEnabled={false}>
183
+ <ScrollView style={rtlMirror} showsVerticalScrollIndicator={false} scrollEnabled={false}>
181
184
  {/* Bottom layer – gradient-filled rows */}
182
185
  {Array.from({ length: 20 }).map((_, i) => (
183
186
  <SkeletonItemBottom key={`bottom-${i}`} style={style} />
@@ -20,6 +20,8 @@ import { DeepPartial } from "../../shared/helper/types";
20
20
  import { JSX } from "react";
21
21
  import { useCometChatTranslation } from "../../shared/resources/CometChatLocalizeNew";
22
22
  import { SafeAreaView } from "react-native-safe-area-context";
23
+ import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection } from "../../shared/helper/layoutDirection";
24
+ import { stripBidiControls } from "../../shared/helper/textDirection";
23
25
 
24
26
  const listnerID = "CALL_LISTENER_" + Date.now() + "_" + (++__listenerIdCounter);
25
27
  const CometChatCalls = CallingPackage.CometChatCalls;
@@ -30,6 +32,8 @@ const CometChatCalls = CallingPackage.CometChatCalls;
30
32
  * @interface CometChatIncomingCallInterface
31
33
  */
32
34
  export interface CometChatIncomingCallInterface {
35
+ /** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
36
+ layoutDirection?: "ltr" | "rtl";
33
37
  /** The incoming call object, which can be a Call or a CustomMessage */
34
38
  call: CometChat.Call | CometChat.CustomMessage | any;
35
39
  /** Custom view for the entire call item */
@@ -84,6 +88,8 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
84
88
  callSettingsBuilder,
85
89
  style,
86
90
  } = props;
91
+ // ENG-41333: own setting → enclosing component → global; drives the root and the context.
92
+ const direction = useComponentLayoutDirection(props.layoutDirection);
87
93
 
88
94
  const theme = useTheme();
89
95
  const { t } = useCometChatTranslation();
@@ -255,7 +261,8 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
255
261
  * Render the default incoming call overlay with header and action buttons.
256
262
  */
257
263
  return (
258
- <SafeAreaView style={styles.overlay}>
264
+ <LayoutDirectionContext.Provider value={direction}>
265
+ <SafeAreaView style={[styles.overlay, directionStyle(direction)]}>
259
266
  <View style={[incomingCallStyle.containerStyle, { width: "100%" }]}>
260
267
  {/* Top row: LeadingView, Title/Subtitle, TrailingView */}
261
268
  <View style={styles.topRow}>
@@ -265,7 +272,7 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
265
272
  TitleView(call)
266
273
  ) : (
267
274
  <Text style={incomingCallStyle.titleTextStyle}>
268
- {call["sender"]?.["name"] ?? t("INCOMING_CALL")}
275
+ {stripBidiControls(call["sender"]?.["name"]) || t("INCOMING_CALL")}
269
276
  </Text>
270
277
  )}
271
278
 
@@ -276,7 +283,7 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
276
283
  <Icon
277
284
  name='call-fill'
278
285
  size={16}
279
- containerStyle={{ marginTop: 4, marginRight: 4 }}
286
+ containerStyle={{ marginTop: 4, marginEnd: 4 }}
280
287
  />
281
288
  <Text style={incomingCallStyle.subtitleTextStyle}>
282
289
  {call?.["type"] === CallTypeConstants.audio
@@ -310,6 +317,7 @@ export const CometChatIncomingCall = (props: CometChatIncomingCallInterface): JS
310
317
  </View>
311
318
  </View>
312
319
  </SafeAreaView>
320
+ </LayoutDirectionContext.Provider>
313
321
  );
314
322
  };
315
323
 
@@ -19,6 +19,8 @@ import { OutgoingCallStyle } from "./styles";
19
19
  import { DeepPartial } from "../../shared/helper/types";
20
20
  import { useCometChatTranslation } from "../../shared/resources/CometChatLocalizeNew";
21
21
  import { SafeAreaView } from "react-native-safe-area-context";
22
+ import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection } from "../../shared/helper/layoutDirection";
23
+ import { stripBidiControls } from "../../shared/helper/textDirection";
22
24
 
23
25
  const listenerId = "callListener_" + Date.now() + "_" + (++__listenerIdCounter);
24
26
  const CometChatCalls = CallingPackage.CometChatCalls;
@@ -29,6 +31,8 @@ const CometChatCalls = CallingPackage.CometChatCalls;
29
31
  * @interface CometChatOutgoingCallInterface
30
32
  */
31
33
  export interface CometChatOutgoingCallInterface {
34
+ /** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
35
+ layoutDirection?: "ltr" | "rtl";
32
36
  /**
33
37
  * The outgoing call object, can be a CometChat.Call or CometChat.CustomMessage.
34
38
  */
@@ -101,6 +105,8 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface): JS
101
105
  EndCallView,
102
106
  onError,
103
107
  } = props;
108
+ // ENG-41333: own setting → enclosing component → global; drives the root and the context.
109
+ const direction = useComponentLayoutDirection(props.layoutDirection);
104
110
 
105
111
  // State to track whether the call is connected.
106
112
  const [isCallConnected, setCallConnected] = useState(false);
@@ -272,9 +278,10 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface): JS
272
278
  setModalVisible(false);
273
279
  };
274
280
 
275
- const callReceiverName = call?.getReceiver?.().getName?.() ?? "Unknown";
281
+ const callReceiverName = stripBidiControls(call?.getReceiver?.().getName?.()) || "Unknown";
276
282
 
277
283
  return (
284
+ <LayoutDirectionContext.Provider value={direction}>
278
285
  <Modal
279
286
  transparent
280
287
  animationType='fade'
@@ -290,7 +297,7 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface): JS
290
297
  callSettingsBuilder={callSettings.current!}
291
298
  />
292
299
  ) : (
293
- <SafeAreaView style={{ flex: 1 }}>
300
+ <SafeAreaView style={[{ flex: 1 }, directionStyle(direction)]}>
294
301
  <View style={outgoingCallStyle.containerStyle}>
295
302
  {TitleView ? (
296
303
  TitleView(call)
@@ -337,5 +344,6 @@ export const CometChatOutgoingCall = (props: CometChatOutgoingCallInterface): JS
337
344
  </SafeAreaView>
338
345
  )}
339
346
  </Modal>
347
+ </LayoutDirectionContext.Provider>
340
348
  );
341
349
  };
@@ -49,8 +49,8 @@ export const getCollabBubbleStyleLight = (
49
49
  height: 1,
50
50
  backgroundColor: color.borderDark,
51
51
  width: 240,
52
- marginLeft: -4, // Negative margin equal to parent's padding
53
- marginRight: -4, // Negative margin equal to parent's padding
52
+ marginStart: -4, // Negative margin equal to parent's padding
53
+ marginEnd: -4, // Negative margin equal to parent's padding
54
54
  }
55
55
  },
56
56
  outgoingBubbleStyle: {
@@ -93,8 +93,8 @@ export const getCollabBubbleStyleLight = (
93
93
  backgroundColor: color.extendedPrimary800,
94
94
  width: 240,
95
95
  //position: 'absolute',
96
- marginLeft: -4, // Negative margin equal to parent's padding
97
- marginRight: -4, // Negative margin equal to parent's padding
96
+ marginStart: -4, // Negative margin equal to parent's padding
97
+ marginEnd: -4, // Negative margin equal to parent's padding
98
98
  }
99
99
  },
100
100
  };
@@ -296,7 +296,7 @@ export class CollaborativeDocumentExtensionDecorator extends DataSourceDecorator
296
296
 
297
297
  return (
298
298
  <View>
299
- <Text>{"no match"}</Text>
299
+ <Text>{t("NOT_SUPPORTED")}</Text>
300
300
  </View>
301
301
  );
302
302
  }