@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
@@ -28,6 +28,8 @@ import { CometChatCaptionText } from '../CometChatCaptionText';
28
28
  import { useCometChatTranslation } from '../../resources/CometChatLocalizeNew';
29
29
  import { ATTACHMENT_COLLAPSED_LIMIT } from '../../constants/UIKitConstants';
30
30
  import { AdditionalParams } from "../../base/Types";
31
+ import { PLAYER_DIRECTION, PLAYER_TIME_ALIGN } from "../../helper/layoutDirection";
32
+ import { localizeDigits } from "../../helper/LocalizedDateHelper";
31
33
 
32
34
  const { SoundPlayer, FileManager } = NativeModules;
33
35
  const soundEvents = new NativeEventEmitter(SoundPlayer);
@@ -83,6 +85,7 @@ const AudioFilePlayer = ({
83
85
  timeTextStyle,
84
86
  downloadIconStyle,
85
87
  }: AudioFilePlayerProps) => {
88
+ const { t, language } = useCometChatTranslation();
86
89
  // Offline ON: play the SDK's cached copy (with an extension AVFoundation accepts); else the URL.
87
90
  const url = useOfflineMediaUri(attachment, { playable: true });
88
91
  // Dimension tokens (theme spacing): CIRCLE 56 = s14, THUMB 12 = s3, TRACK_H = s2 (8) — a proper
@@ -308,12 +311,12 @@ const AudioFilePlayer = ({
308
311
 
309
312
  return (
310
313
  // No own frame — inherits the shared audio-bubble container from the message-bubble wrapper.
311
- <View testID="bubble-audio" style={[{ flexDirection: 'row', alignItems: 'center', gap: S.s3 }, containerStyle]}>
314
+ <View testID="bubble-audio" style={[{ flexDirection: 'row', alignItems: 'center', gap: S.s3 }, containerStyle, PLAYER_DIRECTION]}>
312
315
  {/* Play/pause circle */}
313
316
  <TouchableOpacity
314
317
  onPress={togglePlay}
315
318
  accessibilityRole="button"
316
- accessibilityLabel={status === 'playing' ? 'Pause audio' : 'Play audio'}
319
+ accessibilityLabel={status === 'playing' ? t('PAUSE_AUDIO') : t('PLAY_AUDIO')}
317
320
  style={[{
318
321
  width: CIRCLE,
319
322
  height: CIRCLE,
@@ -379,7 +382,7 @@ const AudioFilePlayer = ({
379
382
  onPress={download}
380
383
  hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
381
384
  accessibilityRole="button"
382
- accessibilityLabel="Download audio"
385
+ accessibilityLabel={t("DOWNLOAD_AUDIO")}
383
386
  >
384
387
  <Icon name="download-fill" size={S.s5} color={downloadColor as string} imageStyle={downloadIconStyle} />
385
388
  </TouchableOpacity>
@@ -387,9 +390,9 @@ const AudioFilePlayer = ({
387
390
 
388
391
  <Text
389
392
  allowFontScaling={false}
390
- style={[{ ...theme.typography.caption2.regular, color: timeColor, marginTop: S.s0_5 }, timeTextStyle]}
393
+ style={[PLAYER_TIME_ALIGN, { ...theme.typography.caption2.regular, color: timeColor, marginTop: S.s0_5 }, timeTextStyle]}
391
394
  >
392
- {`${fmt(displayCur)}/${fmt(duration)}`}
395
+ {localizeDigits(`${fmt(displayCur)}/${fmt(duration)}`, language)}
393
396
  </Text>
394
397
  </View>
395
398
  </View>
@@ -415,6 +418,7 @@ const AudioFileCard = ({
415
418
  fileNameStyle,
416
419
  downloadIconStyle,
417
420
  }: AudioFileCardProps) => {
421
+ const { t } = useCometChatTranslation();
418
422
  const S = theme.spacing.spacing;
419
423
  const url = attachment.getUrl();
420
424
  const nameColor = isSentByMe ? theme.color.sendBubbleText : theme.color.receiveBubbleText;
@@ -437,7 +441,7 @@ const AudioFileCard = ({
437
441
  onPress={download}
438
442
  hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
439
443
  accessibilityRole="button"
440
- accessibilityLabel="Download audio"
444
+ accessibilityLabel={t("DOWNLOAD_AUDIO")}
441
445
  >
442
446
  <Icon name="download-fill" size={S.s5} color={downloadColor as string} imageStyle={downloadIconStyle} />
443
447
  </TouchableOpacity>
@@ -3,6 +3,8 @@ import { Text, View, Dimensions } from "react-native";
3
3
  import { useTheme } from "../../../theme";
4
4
  import { deepMerge } from "../../helper/helperFunctions";
5
5
  import { BadgeStyle } from "./styles";
6
+ import { localizeDigits } from "../../helper/LocalizedDateHelper";
7
+ import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew/useCometChatTranslationHook";
6
8
 
7
9
  /**
8
10
  * Props for the CometChatBadge component.
@@ -30,6 +32,8 @@ export interface CometChatBadgeProps {
30
32
  export const CometChatBadge = (props: CometChatBadgeProps) => {
31
33
  const { style = {}, count = 0 } = props;
32
34
  const theme = useTheme();
35
+ // The context language: the provider sets the global one in an effect, a render later.
36
+ const { language } = useCometChatTranslation();
33
37
 
34
38
  // Merge the theme's badge style with any custom styles provided.
35
39
  const badgeStyle = useMemo(() => {
@@ -40,11 +44,11 @@ export const CometChatBadge = (props: CometChatBadgeProps) => {
40
44
  const countText: string = useMemo(() => {
41
45
  if (Number.isInteger(count)) {
42
46
  if ((count as number) === 0) return "";
43
- if ((count as number) > 999) return "999+";
44
- return (count as number).toString();
47
+ if ((count as number) > 999) return localizeDigits("999+", language);
48
+ return localizeDigits((count as number).toString(), language);
45
49
  }
46
- return count.toString();
47
- }, [count]);
50
+ return localizeDigits(count.toString(), language);
51
+ }, [count, language]);
48
52
 
49
53
  // If count is zero or an empty string, do not render the badge.
50
54
  if (countText.length === 0) return null;
@@ -19,6 +19,7 @@ import {
19
19
  } from "react-native";
20
20
  import { SafeAreaInsetsContext } from "react-native-safe-area-context";
21
21
  import { useTheme } from "../../../theme";
22
+ import { directionStyle, useComponentLayoutDirection } from "../../helper/layoutDirection";
22
23
 
23
24
  /**
24
25
  * Props for the CometChatBottomSheet component.
@@ -79,6 +80,8 @@ export interface CometChatBottomSheetInterface {
79
80
  const CometChatBottomSheet = forwardRef(
80
81
  (props: CometChatBottomSheetInterface, ref) => {
81
82
  const theme = useTheme();
83
+ // Modal content is a new native root: give it the opener's direction (ENG-41333, §4.7).
84
+ const direction = useComponentLayoutDirection();
82
85
  const {
83
86
  style = {
84
87
  maxHeight: Dimensions.get("screen").height * 0.9,
@@ -171,6 +174,7 @@ const CometChatBottomSheet = forwardRef(
171
174
  <Animated.View
172
175
  testID='BottomSheet.overlay'
173
176
  style={{
177
+ ...directionStyle(direction),
174
178
  flex: 1,
175
179
  backgroundColor: overlayAnim.interpolate({
176
180
  inputRange: [0, 0.2],
@@ -194,8 +198,8 @@ const CometChatBottomSheet = forwardRef(
194
198
  bottom: bottomInset,
195
199
  left: 0,
196
200
  right: 0,
197
- borderTopLeftRadius: 24,
198
- borderTopRightRadius: 24,
201
+ borderTopStartRadius: 24,
202
+ borderTopEndRadius: 24,
199
203
  shadowOffset: { width: 0, height: 6 },
200
204
  shadowOpacity: 0.37,
201
205
  shadowRadius: 7.49,
@@ -4,6 +4,7 @@ import { useTheme, useCompTheme } from '../../theme/hook';
4
4
  import { CometChatTheme } from '../../theme/type';
5
5
  import { deepMerge } from '../helper/helperFunctions';
6
6
  import { Icon } from '../icons/Icon';
7
+ import { useCometChatTranslation } from '../resources/CometChatLocalizeNew';
7
8
 
8
9
  export interface CometChatComposerErrorBannerProps {
9
10
  /** Message to show; `null`/empty hides the banner. */
@@ -27,6 +28,7 @@ export interface CometChatComposerErrorBannerProps {
27
28
  */
28
29
  export function CometChatComposerErrorBanner({ message, onDismiss, style }: CometChatComposerErrorBannerProps) {
29
30
  const theme = useTheme();
31
+ const { t } = useCometChatTranslation();
30
32
  const compTheme = useCompTheme();
31
33
  const s = deepMerge(
32
34
  theme.composerErrorBannerStyles ?? {},
@@ -69,7 +71,7 @@ export function CometChatComposerErrorBanner({ message, onDismiss, style }: Come
69
71
  onPress={onDismiss}
70
72
  hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
71
73
  accessibilityRole="button"
72
- accessibilityLabel="Dismiss"
74
+ accessibilityLabel={t("DISMISS")}
73
75
  >
74
76
  <Icon
75
77
  name="close"
@@ -13,7 +13,9 @@ import {
13
13
  ViewStyle,
14
14
  } from "react-native";
15
15
  import { useTheme } from "../../../theme";
16
+ import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
16
17
  import { Icon } from "../../icons/Icon";
18
+ import { directionStyle, useComponentLayoutDirection } from "../../helper/layoutDirection";
17
19
 
18
20
  /**
19
21
  * Props for the CometChatConfirmDialog component.
@@ -101,6 +103,7 @@ export interface CometChatConfirmDialogInterface {
101
103
  * The rendered confirmation dialog.
102
104
  */
103
105
  export const CometChatConfirmDialog = (props: CometChatConfirmDialogInterface) => {
106
+ const { t } = useCometChatTranslation();
104
107
  const {
105
108
  onConfirm,
106
109
  onCancel,
@@ -118,11 +121,13 @@ export const CometChatConfirmDialog = (props: CometChatConfirmDialogInterface) =
118
121
  confirmButtonTextStyle = {},
119
122
  titleText = "",
120
123
  messageText = "",
121
- cancelButtonText = "Cancel",
122
- confirmButtonText = "Delete",
124
+ cancelButtonText = t("CANCEL"),
125
+ confirmButtonText = t("DELETE"),
123
126
  } = props;
124
127
 
125
128
  const theme = useTheme();
129
+ // Modal content is a new native root: give it the opener's direction (ENG-41333, §4.7).
130
+ const direction = useComponentLayoutDirection();
126
131
 
127
132
  return (
128
133
  <Modal
@@ -132,7 +137,7 @@ export const CometChatConfirmDialog = (props: CometChatConfirmDialogInterface) =
132
137
  onRequestClose={onCancel}
133
138
  onDismiss={onDismiss}
134
139
  >
135
- <Pressable onPress={onCancel} style={styles.wrapper}>
140
+ <Pressable onPress={onCancel} style={[styles.wrapper, directionStyle(direction)]}>
136
141
  <View style={[theme.confirmDialogStyles.containerStyle, containerStyle]}>
137
142
  {icon && (
138
143
  <View style={[theme.confirmDialogStyles.iconContainerStyle, iconContainerStyle]}>
@@ -141,13 +141,13 @@ const styles = (theme: ReturnType<typeof useTheme>) =>
141
141
  },
142
142
  scrollContent: {
143
143
  gap: 8,
144
- paddingRight: 8,
144
+ paddingEnd: 8,
145
145
  },
146
146
  shimmerChip: {
147
147
  height: 36,
148
148
  borderRadius: 18,
149
149
  backgroundColor: theme.color.background4,
150
- marginRight: 8,
150
+ marginEnd: 8,
151
151
  },
152
152
  chip: {
153
153
  paddingHorizontal: 16,
@@ -11,6 +11,7 @@ import {
11
11
  import { useTheme } from "../../../theme";
12
12
  import { Icon } from "../../icons/Icon";
13
13
  import { Emojis } from "./emojis";
14
+ import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew";
14
15
  import Styles from "./style";
15
16
  import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
16
17
 
@@ -92,7 +93,7 @@ const CategoryList: React.FC<CategoryListProps> = React.memo(
92
93
  <TouchableOpacity
93
94
  key={emojiCategory.id}
94
95
  onPress={() => onCategorySelected(emojiCategory.id)}
95
- accessibilityLabel={`Category ${emojiCategory.name}`}
96
+ accessibilityLabel={emojiCategory.name}
96
97
  accessibilityRole='button'
97
98
  >
98
99
  <View style={[styles.iconContainer, isActive && styles.activeIcon]}>
@@ -174,7 +175,8 @@ const CometChatEmojiKeyboard: React.FC<CometChatEmojiKeyboardProps> = ({
174
175
 
175
176
  // State for the currently active category and header title.
176
177
  const [activeCategory, setActiveCategory] = useState<string | null>(null);
177
- const [headerTitle, setHeaderTitle] = useState("Emojis");
178
+ const { t } = useCometChatTranslation();
179
+ const [headerTitle, setHeaderTitle] = useState(() => t("EMOJI"));
178
180
 
179
181
  // A ref to the FlatList for programmatic scrolling.
180
182
  const flatListRef = useRef<FlatList<EmojiItem>>(null);
@@ -250,7 +252,7 @@ const CometChatEmojiKeyboard: React.FC<CometChatEmojiKeyboardProps> = ({
250
252
  <TouchableOpacity
251
253
  onPress={() => handleEmojiPress(item.char)}
252
254
  style={styles.emojiItem}
253
- accessibilityLabel={`Emoji ${item.char}`}
255
+ accessibilityLabel={item.char}
254
256
  accessibilityRole='button'
255
257
  >
256
258
  <Text style={[styles.emojiText, { color: theme.color.primary }]}>{item.char}</Text>
@@ -5,7 +5,7 @@ export const Emojis = [
5
5
  {
6
6
  people: {
7
7
  id: "people",
8
- name: t("SMILEY_PEOPLE"),
8
+ get name() { return t("SMILEY_PEOPLE"); },
9
9
  symbol: "Smileys",
10
10
  emojis: {
11
11
  grinning: {
@@ -1704,7 +1704,7 @@ export const Emojis = [
1704
1704
  {
1705
1705
  animals: {
1706
1706
  id: "animals_and_nature",
1707
- name: t("ANIMALES_NATURE"),
1707
+ get name() { return t("ANIMALES_NATURE"); },
1708
1708
  symbol: "Animals",
1709
1709
  emojis: {
1710
1710
  dog: {
@@ -2467,7 +2467,7 @@ export const Emojis = [
2467
2467
  {
2468
2468
  food: {
2469
2469
  id: "food_and_drink",
2470
- name: t("FOOD_DRINK"),
2470
+ get name() { return t("FOOD_DRINK"); },
2471
2471
  symbol: "Food",
2472
2472
  emojis: {
2473
2473
  green_apple: {
@@ -2950,7 +2950,7 @@ export const Emojis = [
2950
2950
  {
2951
2951
  activity: {
2952
2952
  id: "activity",
2953
- name: t("ACTIVITY"),
2953
+ get name() { return t("ACTIVITY"); },
2954
2954
  symbol: "Activity",
2955
2955
  emojis: {
2956
2956
  soccer: {
@@ -3380,7 +3380,7 @@ export const Emojis = [
3380
3380
  {
3381
3381
  travel: {
3382
3382
  id: "travel_and_places",
3383
- name: t("TRAVEL_PLACES"),
3383
+ get name() { return t("TRAVEL_PLACES"); },
3384
3384
  symbol: "Travel",
3385
3385
  emojis: {
3386
3386
  red_car: {
@@ -3876,7 +3876,7 @@ export const Emojis = [
3876
3876
  {
3877
3877
  objects: {
3878
3878
  id: "objects",
3879
- name: t("OBJECTS"),
3879
+ get name() { return t("OBJECTS"); },
3880
3880
  symbol: "Objects",
3881
3881
  emojis: {
3882
3882
  watch: {
@@ -4771,7 +4771,7 @@ export const Emojis = [
4771
4771
  {
4772
4772
  symbols: {
4773
4773
  id: "symbols",
4774
- name: t("SYMBOLS"),
4774
+ get name() { return t("SYMBOLS"); },
4775
4775
  symbol: "Symbols",
4776
4776
  emojis: {
4777
4777
  heart: {
@@ -5931,7 +5931,7 @@ export const Emojis = [
5931
5931
  {
5932
5932
  flags: {
5933
5933
  id: "flags",
5934
- name: t("FLAGS"),
5934
+ get name() { return t("FLAGS"); },
5935
5935
  symbol: "Flags",
5936
5936
  emojis: {
5937
5937
  afghanistan: {
@@ -12,10 +12,10 @@ const Styles = (theme: CometChatTheme) => {
12
12
  return StyleSheet.create({
13
13
  fixedHeader: {
14
14
  paddingBottom: 8,
15
- paddingLeft: 12,
15
+ paddingStart: 12,
16
16
  alignSelf: "flex-start",
17
17
  top: 0,
18
- left: 0,
18
+ start: 0,
19
19
  zIndex: 1,
20
20
  },
21
21
  flatListContent: {
@@ -17,6 +17,7 @@ import { OFFLINE_STRING_KEYS } from '../../offline/notices';
17
17
  import { deepMerge } from '../../helper/helperFunctions';
18
18
  import { useCompTheme } from '../../../theme/hook';
19
19
  import { Icon } from '../../icons/Icon';
20
+ import { fileSizeLabel } from '../../utils/fileSizeLabel';
20
21
  import { getFileTypeIcon, ATTACHMENT_COLLAPSED_LIMIT } from '../../constants/UIKitConstants';
21
22
  import { useCometChatTranslation } from '../../resources/CometChatLocalizeNew';
22
23
  import { groupAttachments } from '../../utils/groupAttachments';
@@ -43,9 +44,9 @@ function formatFileSize(bytes?: number): string {
43
44
  // Missing/invalid size (e.g. an attachment reconstructed without a size field) → no label,
44
45
  // so the row shows just the extension instead of "undefined B".
45
46
  if (typeof bytes !== 'number' || !isFinite(bytes) || bytes <= 0) return '';
46
- if (bytes >= 1_048_576) return `${(bytes / 1_048_576).toFixed(1)} MB`;
47
- if (bytes >= 1_024) return `${Math.round(bytes / 1_024)} KB`;
48
- return `${bytes} B`;
47
+ if (bytes >= 1_048_576) return fileSizeLabel('FILE_SIZE_MB', (bytes / 1_048_576).toFixed(1));
48
+ if (bytes >= 1_024) return fileSizeLabel('FILE_SIZE_KB', Math.round(bytes / 1_024));
49
+ return fileSizeLabel('FILE_SIZE_BYTES', bytes);
49
50
  }
50
51
 
51
52
  function getExtension(name: string): string {
@@ -241,7 +242,7 @@ export function CometChatFilesBubble({
241
242
  : { paddingVertical: S.padding.p3, paddingHorizontal: S.padding.p3 }),
242
243
  }}
243
244
  accessibilityRole="button"
244
- accessibilityLabel={`Download ${file.getName()}`}
245
+ accessibilityLabel={t('DOWNLOAD_FILE_NAMED').replace('{name}', () => file.getName())}
245
246
  >
246
247
  {/* Colored file type icon */}
247
248
  <Icon name={getFileTypeIcon(file.getName())} size={S.spacing.s8} />
@@ -3,8 +3,12 @@ import { ActivityIndicator, Image, Modal, StyleSheet, TouchableOpacity, View } f
3
3
  import { SafeAreaView, useSafeAreaInsets } from "react-native-safe-area-context";
4
4
  import { ReactNativeZoomableViewWithGestures } from "../../libs/ImageZoom";
5
5
  import { Icon } from "../../icons/Icon";
6
+ import { directionStyle, useComponentLayoutDirection, useKitRTL } from "../../helper/layoutDirection";
6
7
 
7
8
  export const ImageViewerModal = ({ imageUrl, isVisible, onClose }: any) => {
9
+ // Modal content is a new native root: give it the opener's direction (ENG-41333, §4.7).
10
+ const direction = useComponentLayoutDirection();
11
+ const isRTL = useKitRTL();
8
12
  const [downloaded, setDownloaded] = useState(false);
9
13
  const insets = useSafeAreaInsets();
10
14
 
@@ -19,7 +23,7 @@ export const ImageViewerModal = ({ imageUrl, isVisible, onClose }: any) => {
19
23
  return (
20
24
  <Modal animationType='slide' transparent={false} visible={isVisible} onRequestClose={onClose}>
21
25
  {/* keep SafeAreaView so bottom inset is handled too */}
22
- <SafeAreaView style={styles.centeredView} edges={["bottom"]}>
26
+ <SafeAreaView style={[styles.centeredView, directionStyle(direction)]} edges={["bottom"]}>
23
27
  <View
24
28
  style={[
25
29
  styles.header,
@@ -34,8 +38,8 @@ export const ImageViewerModal = ({ imageUrl, isVisible, onClose }: any) => {
34
38
  style={[
35
39
  styles.closeButton,
36
40
  {
37
- // respect left inset (very useful on iPhone with rounded corners)
38
- marginLeft: Math.max(10, insets.left + 6),
41
+ // Clear the rounded corner on the start side (the inset is physical, the margin logical).
42
+ marginStart: Math.max(10, (isRTL ? insets.right : insets.left) + 6),
39
43
  },
40
44
  ]}
41
45
  onPress={onClose}
@@ -14,6 +14,10 @@ import { CometChatMediaViewer } from '../CometChatMediaViewer';
14
14
  import { CometChatCaptionText } from '../CometChatCaptionText';
15
15
  import { Icon } from '../../icons/Icon';
16
16
  import { isImageMime } from '../CometChatMediaViewer/mediaViewerUtils';
17
+ import { localizeDigits } from '../../helper/LocalizedDateHelper';
18
+ import { pinLtr } from '../../helper/textDirection';
19
+ // The hook module itself: the folder index also loads the I18n provider.
20
+ import { useCometChatTranslation } from '../../resources/CometChatLocalizeNew/useCometChatTranslationHook';
17
21
  import { AdditionalParams } from "../../base/Types";
18
22
 
19
23
  // ---------------------------------------------------------------------------
@@ -23,10 +27,10 @@ import { AdditionalParams } from "../../base/Types";
23
27
  // ---------------------------------------------------------------------------
24
28
 
25
29
  interface BorderRadii {
26
- topLeft?: number;
27
- topRight?: number;
28
- bottomLeft?: number;
29
- bottomRight?: number;
30
+ topStart?: number;
31
+ topEnd?: number;
32
+ bottomStart?: number;
33
+ bottomEnd?: number;
30
34
  }
31
35
 
32
36
  // ---- Cell ----------------------------------------------------------------
@@ -55,6 +59,7 @@ const ImageCell = ({
55
59
  overflowTextStyle,
56
60
  }: ImageCellProps) => {
57
61
  const theme = useTheme();
62
+ const { language } = useCometChatTranslation();
58
63
  // Offline ON: the SDK's cached copy when it has one, else the URL (exactly today's with offline off).
59
64
  const imageUri = useOfflineMediaUri(attachment);
60
65
  // An IMAGE bubble previews images only. A non-image attachment (video/audio/file) OR an image that
@@ -80,10 +85,10 @@ const ImageCell = ({
80
85
  // image so a valid image never flashes the "no preview" placeholder for a frame before it loads.
81
86
  const showPlaceholder = (mime.includes('/') && !isImageMime(mime)) || failed;
82
87
  const borderStyle = {
83
- borderTopLeftRadius: radii.topLeft ?? 0,
84
- borderTopRightRadius: radii.topRight ?? 0,
85
- borderBottomLeftRadius: radii.bottomLeft ?? 0,
86
- borderBottomRightRadius: radii.bottomRight ?? 0,
88
+ borderTopStartRadius: radii.topStart ?? 0,
89
+ borderTopEndRadius: radii.topEnd ?? 0,
90
+ borderBottomStartRadius: radii.bottomStart ?? 0,
91
+ borderBottomEndRadius: radii.bottomEnd ?? 0,
87
92
  };
88
93
 
89
94
  return (
@@ -125,7 +130,8 @@ const ImageCell = ({
125
130
  style={[StyleSheet.absoluteFill, { backgroundColor: theme.color.mediaOverlay, justifyContent: 'center', alignItems: 'center' }, overflowOverlayStyle]}
126
131
  >
127
132
  {/* heading1.bold = { fontSize: 24, fontWeight: '700' }; letterSpacing -0.5 is a micro-adjust. */}
128
- <Text style={[{ ...theme.typography.heading1.bold, color: theme.color.staticWhite, letterSpacing: -0.5 }, overflowTextStyle]}>{`+${overflowCount}`}</Text>
133
+ {/* Android ENG-57501: the language's digits, pinned LTR so RTL never draws "3+". */}
134
+ <Text style={[{ ...theme.typography.heading1.bold, color: theme.color.staticWhite, letterSpacing: -0.5 }, overflowTextStyle]}>{pinLtr(localizeDigits(`+${overflowCount}`, language))}</Text>
129
135
  </View>
130
136
  )}
131
137
  </TouchableOpacity>
@@ -173,25 +179,25 @@ const ImageGrid = ({
173
179
  if (count === 1) {
174
180
  return (
175
181
  <View style={{ flexDirection: 'row' }}>
176
- {cell(0, { topLeft: CORNER, topRight: CORNER, bottomLeft: CORNER, bottomRight: CORNER }, 4 / 3)}
182
+ {cell(0, { topStart: CORNER, topEnd: CORNER, bottomStart: CORNER, bottomEnd: CORNER }, 4 / 3)}
177
183
  </View>
178
184
  );
179
185
  }
180
186
  if (count === 2) {
181
187
  return (
182
188
  <View style={{ flexDirection: 'row', gap: GAP }}>
183
- {cell(0, { topLeft: CORNER, bottomLeft: CORNER })}
184
- {cell(1, { topRight: CORNER, bottomRight: CORNER })}
189
+ {cell(0, { topStart: CORNER, bottomStart: CORNER })}
190
+ {cell(1, { topEnd: CORNER, bottomEnd: CORNER })}
185
191
  </View>
186
192
  );
187
193
  }
188
194
  if (count === 3) {
189
195
  return (
190
196
  <View style={{ gap: GAP }}>
191
- <View style={{ flexDirection: 'row' }}>{cell(0, { topLeft: CORNER, topRight: CORNER }, 4 / 3)}</View>
197
+ <View style={{ flexDirection: 'row' }}>{cell(0, { topStart: CORNER, topEnd: CORNER }, 4 / 3)}</View>
192
198
  <View style={{ flexDirection: 'row', gap: GAP }}>
193
- {cell(1, { bottomLeft: CORNER })}
194
- {cell(2, { bottomRight: CORNER })}
199
+ {cell(1, { bottomStart: CORNER })}
200
+ {cell(2, { bottomEnd: CORNER })}
195
201
  </View>
196
202
  </View>
197
203
  );
@@ -200,12 +206,12 @@ const ImageGrid = ({
200
206
  return (
201
207
  <View style={{ gap: GAP }}>
202
208
  <View style={{ flexDirection: 'row', gap: GAP }}>
203
- {cell(0, { topLeft: CORNER })}
204
- {cell(1, { topRight: CORNER })}
209
+ {cell(0, { topStart: CORNER })}
210
+ {cell(1, { topEnd: CORNER })}
205
211
  </View>
206
212
  <View style={{ flexDirection: 'row', gap: GAP }}>
207
- {cell(2, { bottomLeft: CORNER })}
208
- {cell(3, { bottomRight: CORNER })}
213
+ {cell(2, { bottomStart: CORNER })}
214
+ {cell(3, { bottomEnd: CORNER })}
209
215
  </View>
210
216
  </View>
211
217
  );
@@ -215,12 +221,12 @@ const ImageGrid = ({
215
221
  return (
216
222
  <View style={{ gap: GAP }}>
217
223
  <View style={{ flexDirection: 'row', gap: GAP }}>
218
- {cell(0, { topLeft: CORNER })}
219
- {cell(1, { topRight: CORNER })}
224
+ {cell(0, { topStart: CORNER })}
225
+ {cell(1, { topEnd: CORNER })}
220
226
  </View>
221
227
  <View style={{ flexDirection: 'row', gap: GAP }}>
222
- {cell(2, { bottomLeft: CORNER })}
223
- {cell(3, { bottomRight: CORNER }, undefined, overflowCount)}
228
+ {cell(2, { bottomStart: CORNER })}
229
+ {cell(3, { bottomEnd: CORNER }, undefined, overflowCount)}
224
230
  </View>
225
231
  </View>
226
232
  );
@@ -14,6 +14,9 @@ import { getInlineAudioRecorderStyle } from './style';
14
14
  import {
15
15
  CometChatInlineAudioRecorderProps,
16
16
  } from './types';
17
+ import { PLAYER_DIRECTION } from "../../helper/layoutDirection";
18
+ import { localizeDigits } from "../../helper/LocalizedDateHelper";
19
+ import { useCometChatTranslation } from "../../resources/CometChatLocalizeNew/useCometChatTranslationHook";
17
20
 
18
21
  /**
19
22
  * Formats duration in milliseconds to MM:SS format.
@@ -62,6 +65,8 @@ export const CometChatInlineAudioRecorder: React.FC<CometChatInlineAudioRecorder
62
65
  playIcon,
63
66
  }) => {
64
67
  const theme = useTheme();
68
+ // The context language: the provider sets the global one in an effect, a render later.
69
+ const { language } = useCometChatTranslation();
65
70
  const recorder = useAudioRecorder();
66
71
 
67
72
  // Animation value for the pulsing recording indicator
@@ -444,28 +449,38 @@ export const CometChatInlineAudioRecorder: React.FC<CometChatInlineAudioRecorder
444
449
  />
445
450
  </TouchableOpacity>
446
451
 
447
- {/* Record/Play Button */}
448
- {renderRecordPlayButton()}
449
-
450
- {/* Waveform Visualizer */}
451
- <View style={styles.waveformContainer}>
452
- <AudioWaveformVisualizer
453
- isAnimating={recorder.isRecording}
454
- isPlaying={recorder.isPlaying}
455
- playbackProgress={playbackProgress}
456
- amplitudes={recorder.amplitudes}
457
- onSeek={handleSeek}
458
- onSeekStart={handleSeekStart}
459
- onSeekEnd={handleSeekEnd}
460
- allowSeeking={allowSeeking}
461
- style={mergedStyle.waveformStyle}
462
- />
463
- </View>
452
+ {/* ENG-41316: the player part (play, waveform, time) stays left to right in RTL; the strip
453
+ around it (delete, pause/mic, send) follows the layout (design: Media Recorder, RTL). */}
454
+ <View
455
+ style={[
456
+ styles.player,
457
+ { gap: (mergedStyle.containerStyle as { gap?: number } | undefined)?.gap ?? 12 },
458
+ PLAYER_DIRECTION,
459
+ ]}
460
+ >
461
+ {/* Record/Play Button */}
462
+ {renderRecordPlayButton()}
463
+
464
+ {/* Waveform Visualizer */}
465
+ <View style={styles.waveformContainer}>
466
+ <AudioWaveformVisualizer
467
+ isAnimating={recorder.isRecording}
468
+ isPlaying={recorder.isPlaying}
469
+ playbackProgress={playbackProgress}
470
+ amplitudes={recorder.amplitudes}
471
+ onSeek={handleSeek}
472
+ onSeekStart={handleSeekStart}
473
+ onSeekEnd={handleSeekEnd}
474
+ allowSeeking={allowSeeking}
475
+ style={mergedStyle.waveformStyle}
476
+ />
477
+ </View>
464
478
 
465
- {/* Duration Display */}
466
- <Text style={[styles.duration, mergedStyle.durationTextStyle]}>
467
- {displayDuration}
468
- </Text>
479
+ {/* Duration Display */}
480
+ <Text style={[styles.duration, mergedStyle.durationTextStyle]}>
481
+ {localizeDigits(displayDuration, language)}
482
+ </Text>
483
+ </View>
469
484
 
470
485
  {/* Pause/Mic Button */}
471
486
  {renderPauseMicButton()}
@@ -517,6 +532,11 @@ const styles = StyleSheet.create({
517
532
  waveformContainer: {
518
533
  flex: 1,
519
534
  },
535
+ player: {
536
+ flex: 1,
537
+ flexDirection: 'row',
538
+ alignItems: 'center',
539
+ },
520
540
  duration: {
521
541
  // Gap handles spacing between elements
522
542
  },
@@ -6,6 +6,10 @@ import {
6
6
  UseAudioRecorderReturn,
7
7
  AudioSegment,
8
8
  } from './types';
9
+ import { getCometChatTranslation } from '../../resources/CometChatLocalizeNew/LocalizationManager';
10
+
11
+ // Reads the current language when called, so the alert follows a language change.
12
+ const t = getCometChatTranslation();
9
13
 
10
14
  // Create event emitter for FileManager
11
15
  const FileManagerEmitter = new NativeEventEmitter(NativeModules.FileManager);
@@ -483,15 +487,15 @@ export function useAudioRecorder(): UseAudioRecorderReturn {
483
487
  const showPermissionAlert = useCallback(() => {
484
488
  Alert.alert(
485
489
  '',
486
- 'Microphone permission is required to record audio. Please enable it in settings.',
490
+ t('MICROPHONE_PERMISSION'),
487
491
  [
488
492
  {
489
493
  style: 'cancel',
490
- text: 'Cancel',
494
+ text: t('CANCEL'),
491
495
  },
492
496
  {
493
497
  style: 'default',
494
- text: 'Settings',
498
+ text: t('SETTINGS'),
495
499
  onPress: () => {
496
500
  Linking.openSettings();
497
501
  },