@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.
- package/android/src/main/java/com/reactnativecometchatuikit/CometChatKeyboardModule.kt +101 -0
- package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +1 -0
- package/android/src/main/java/com/reactnativecometchatuikit/KeyboardDirectionWatcher.kt +64 -0
- package/android/src/main/java/com/reactnativecometchatuikit/KeyboardLanguageDirection.kt +44 -0
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +287 -49
- package/ios/CometChatKeyboardModule.m +9 -0
- package/ios/CometChatKeyboardModule.swift +71 -0
- package/ios/KeyboardLanguageDirection.swift +24 -0
- package/ios/RichTextEditorView.swift +253 -51
- package/ios/RichTextEditorViewManager.m +1 -0
- package/package.json +1 -1
- package/src/CometChatAIAssistantChatHistory/CometChatAIAssistantChatHistory.tsx +41 -57
- package/src/CometChatAIAssistantChatHistory/Skeleton.tsx +4 -1
- package/src/CometChatAIAssistantChatHistory/style.ts +5 -2
- package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +21 -8
- package/src/CometChatCompactMessageComposer/styles.ts +7 -7
- package/src/CometChatConversations/CometChatConversations.tsx +36 -30
- package/src/CometChatConversations/Skeleton.tsx +4 -1
- package/src/CometChatConversations/style.ts +1 -1
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +35 -18
- package/src/CometChatGroupMembers/Skeleton.tsx +4 -1
- package/src/CometChatGroupMembers/style.ts +6 -4
- package/src/CometChatGroups/CometChatGroups.tsx +13 -6
- package/src/CometChatGroups/GroupsStyle.ts +1 -1
- package/src/CometChatGroups/Skeleton.tsx +4 -1
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +44 -30
- package/src/CometChatMessageComposer/styles.tsx +1 -1
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +22 -13
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +8 -1
- package/src/CometChatMessageInformation/Skeleton.tsx +4 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +97 -128
- package/src/CometChatMessageList/SwipeToReplyView.tsx +61 -0
- package/src/CometChatMessageList/style.ts +32 -32
- package/src/CometChatMessageList/swipeToReply.ts +25 -0
- package/src/CometChatNotificationFeed/CometChatNotificationFeed.tsx +10 -3
- package/src/CometChatNotificationFeed/style.ts +1 -1
- package/src/CometChatNotificationFeed/utils.ts +17 -18
- package/src/CometChatPinnedMessages/CometChatPinnedMessages.tsx +8 -1
- package/src/CometChatPinnedMessages/style.ts +5 -5
- package/src/CometChatRichTextEditor/RichTextEditorViewNativeComponent.ts +2 -0
- package/src/CometChatRichTextEditor/index.tsx +3 -0
- package/src/CometChatSavedMessages/CometChatSavedMessages.tsx +14 -11
- package/src/CometChatSavedMessages/style.ts +3 -3
- package/src/CometChatSearch/CometChatSearch.tsx +38 -35
- package/src/CometChatSearch/Skeleton.tsx +4 -1
- package/src/CometChatSearch/searchLabels.ts +26 -0
- package/src/CometChatSearch/style.ts +7 -7
- package/src/CometChatThreadHeader/CometChatThreadHeader.tsx +11 -7
- package/src/CometChatThreadHeader/Header.tsx +2 -2
- package/src/CometChatUsers/CometChatUsers.tsx +8 -1
- package/src/CometChatUsers/Skeleton.tsx +4 -1
- package/src/CometChatUsers/style.ts +1 -1
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +8 -1
- package/src/calls/CometChatCallLogs/CometChatCallLogs.tsx +16 -4
- package/src/calls/CometChatCallLogs/Skeleton.tsx +4 -1
- package/src/calls/CometChatIncomingCall/CometChatIncomingCall.tsx +11 -3
- package/src/calls/CometChatOutgoingCall/CometChatOutgoingCall.tsx +10 -2
- package/src/extensions/CollaborativeBubble/style.ts +4 -4
- package/src/extensions/CollaborativeDocument/CollaborativeDocumentExtensionDecorator.tsx +1 -1
- package/src/extensions/CollaborativeWhiteboard/CollaborativeWhiteboardExtensionDecorator.tsx +1 -1
- package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +11 -6
- package/src/extensions/LinkPreview/style.ts +6 -6
- package/src/extensions/Polls/Header.tsx +1 -1
- package/src/extensions/Polls/Polls.tsx +25 -12
- package/src/extensions/Polls/PollsBubble.tsx +10 -6
- package/src/extensions/Polls/style.ts +4 -4
- package/src/extensions/Stickers/CometChatStickerKeyboard/CometChatStickerKeyboard.tsx +2 -2
- package/src/extensions/Stickers/CometChatStickerKeyboard/Skeleton.tsx +1 -1
- package/src/extensions/Stickers/CometChatStickerKeyboard/style.ts +1 -1
- package/src/extensions/Stickers/StickersExtensionDecorator.tsx +2 -2
- package/src/index.ts +5 -1
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +17 -0
- package/src/shared/CometChatUiKit/UIKitSettings.ts +8 -0
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +13 -10
- package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +15 -7
- package/src/shared/formatters/CometChatTextFormatter.ts +11 -0
- package/src/shared/formatters/CometChatUrlsFormatter/index.tsx +7 -4
- package/src/shared/framework/MessageDataSource.tsx +17 -94
- package/src/shared/helper/LocalizedDateHelper.ts +64 -4
- package/src/shared/helper/helperFunctions.ts +71 -4
- package/src/shared/helper/keyboardDirection.ts +54 -0
- package/src/shared/helper/layoutDirection.ts +205 -0
- package/src/shared/helper/pluralRules.ts +67 -0
- package/src/shared/helper/textDirection.ts +118 -0
- package/src/shared/icons/Icon.tsx +37 -2
- package/src/shared/icons/components/format-list-numbered-rtl.tsx +15 -0
- package/src/shared/offline/OfflineViews.tsx +5 -1
- package/src/shared/offline/notices.ts +15 -21
- package/src/shared/resources/CometChatLocalizeNew/CometChatLocalizationHelper.ts +2 -0
- package/src/shared/resources/CometChatLocalizeNew/resources/ar/translation.json +720 -0
- package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +50 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +51 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +50 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +51 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +50 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +50 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +50 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +50 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +50 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +58 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +50 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +50 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +50 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +66 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +50 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +50 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +50 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +50 -2
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +13 -12
- package/src/shared/utils/CometChatMessagePreview/style.ts +1 -1
- package/src/shared/utils/MessageUtils.tsx +14 -14
- package/src/shared/utils/PermissionUtil.ts +16 -5
- package/src/shared/utils/attachmentLimits.ts +3 -2
- package/src/shared/utils/conversationUtils.ts +3 -5
- package/src/shared/utils/fileIconFontSize.ts +10 -0
- package/src/shared/utils/fileSizeLabel.ts +16 -0
- package/src/shared/utils/groupActionText.ts +75 -0
- package/src/shared/views/CometChatAIAssistantMessageBubble/CometChatAIAssistantMessageBubble.tsx +12 -8
- package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreview.style.ts +1 -1
- package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreviewItem.tsx +5 -3
- package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTile.tsx +22 -17
- package/src/shared/views/CometChatAttachmentViewer/CometChatAttachmentViewer.tsx +13 -9
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +16 -10
- package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +10 -6
- package/src/shared/views/CometChatBadge/CometChatBadge.tsx +8 -4
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +6 -2
- package/src/shared/views/CometChatComposerErrorBanner.tsx +3 -1
- package/src/shared/views/CometChatConfirmDialog/CometChatConfirmDialog.tsx +8 -3
- package/src/shared/views/CometChatConversationStarter/CometChatConversationStarter.tsx +2 -2
- package/src/shared/views/CometChatEmojiKeyboard/CometChatEmojiKeyboard.tsx +5 -3
- package/src/shared/views/CometChatEmojiKeyboard/emojis.ts +8 -8
- package/src/shared/views/CometChatEmojiKeyboard/style.ts +2 -2
- package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +5 -4
- package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +7 -3
- package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +29 -23
- package/src/shared/views/CometChatInlineAudioRecorder/CometChatInlineAudioRecorder.tsx +41 -21
- package/src/shared/views/CometChatInlineAudioRecorder/useAudioRecorder.ts +7 -3
- package/src/shared/views/CometChatLinkConfirmPopup/CometChatLinkConfirmPopup.tsx +7 -3
- package/src/shared/views/CometChatList/CometChatList.tsx +10 -14
- package/src/shared/views/CometChatList/Header.tsx +5 -2
- package/src/shared/views/CometChatList/sectionLetter.ts +44 -0
- package/src/shared/views/CometChatList/styles.ts +7 -7
- package/src/shared/views/CometChatListItem/CometChatListItem.tsx +6 -4
- package/src/shared/views/CometChatMediaRecorder/CometChatAudioPlayer.tsx +16 -10
- package/src/shared/views/CometChatMediaRecorder/Timer.tsx +5 -1
- package/src/shared/views/CometChatMediaViewer/CometChatMediaViewer.tsx +16 -11
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +24 -4
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +18 -2
- package/src/shared/views/CometChatNewMessageIndicator/CometChatNewMessageIndicator.tsx +3 -2
- package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +3 -2
- package/src/shared/views/CometChatReactionList/ReactionListStyle.tsx +2 -2
- package/src/shared/views/CometChatReactionList/Skeleton.tsx +4 -1
- package/src/shared/views/CometChatReactions/CometChatReactions.tsx +6 -2
- package/src/shared/views/CometChatReportDialog/CometChatReportDialog.tsx +7 -3
- package/src/shared/views/CometChatReportDialog/style.ts +1 -1
- package/src/shared/views/CometChatSmartReplies/CometChatSmartReplies.tsx +1 -1
- package/src/shared/views/CometChatStreamMessageBubble/CometChatStreamMessageBubble.tsx +20 -13
- package/src/shared/views/CometChatSuggestionList/CometChatSuggestionList.tsx +3 -2
- package/src/shared/views/CometChatSuggestionList/Skeleton.tsx +1 -1
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +29 -3
- package/src/shared/views/CometChatTooltipMenu/CometChatTooltipMenu.tsx +20 -30
- package/src/shared/views/CometChatTooltipMenu/tooltipPosition.ts +43 -0
- package/src/shared/views/CometChatVideoBubble/style.ts +2 -2
- package/src/shared/views/CometChatVideoPlayer/CometChatVideoPlayer.tsx +4 -1
- package/src/shared/views/CometChatVideosBubble/CometChatVideosBubble.tsx +22 -22
- package/src/shared/views/SenderLabel.tsx +41 -0
- package/src/theme/default/default.ts +1 -1
|
@@ -17,6 +17,7 @@ import { SearchStyle, getSearchStyleLight, getSearchStyleDark } from './style';
|
|
|
17
17
|
import { deepMerge } from '../shared/helper/helperFunctions';
|
|
18
18
|
import { DeepPartial } from '../shared/helper/types';
|
|
19
19
|
import { getCometChatTranslation } from '../shared/resources/CometChatLocalizeNew/LocalizationManager';
|
|
20
|
+
import { fileIconFontSize } from "../shared/utils/fileIconFontSize";
|
|
20
21
|
import { CommonUtils } from '../shared/utils/CommonUtils';
|
|
21
22
|
import { selectLinkPreview } from "../shared/utils/linkPreviewSelection";
|
|
22
23
|
import { unescapeTypedMentionTokens } from "../shared/utils/mentionTokens";
|
|
@@ -26,6 +27,10 @@ import { CometChatTextFormatter } from '../shared/formatters/CometChatTextFormat
|
|
|
26
27
|
import { applyRawFormatters } from '../shared/formatters/applyRawFormatters';
|
|
27
28
|
import { ExtensionConstants } from '../extensions/ExtensionConstants';
|
|
28
29
|
import { getExtensionData } from '../extensions/ExtensionModerator';
|
|
30
|
+
import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection, TEXT_START, useInputTextAlign } from "../shared/helper/layoutDirection";
|
|
31
|
+
import { SenderLabel } from "../shared/views/SenderLabel";
|
|
32
|
+
import { stripBidiControls } from "../shared/helper/textDirection";
|
|
33
|
+
import { mediaCountLabel, monthHeaderLabel } from "./searchLabels";
|
|
29
34
|
import { readListPage } from "../shared/offline/twoPhase";
|
|
30
35
|
import { useOfflineSessionEnded } from "../shared/offline/useOfflineSessionEnded";
|
|
31
36
|
import { useOfflineReconnect } from "../shared/offline/useOfflineReconnect";
|
|
@@ -333,6 +338,8 @@ function searchStateReducer(state: SearchState, action: SearchAction): SearchSta
|
|
|
333
338
|
* Props for the CometChatSearch component
|
|
334
339
|
*/
|
|
335
340
|
interface CometChatSearchProps {
|
|
341
|
+
/** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
|
|
342
|
+
layoutDirection?: "ltr" | "rtl";
|
|
336
343
|
/**
|
|
337
344
|
* Callback triggered when the back button is clicked
|
|
338
345
|
* Use this to handle navigation when user clicks the back button
|
|
@@ -534,8 +541,8 @@ const DocumentTypeIcon = ({ width = 48, height = 48 }: { width?: number; height?
|
|
|
534
541
|
d='M55.6667 23.332L67 23.332L50.3333 6.66536L50.3333 17.9987C50.3333 20.9442 52.7212 23.332 55.6667 23.332Z'
|
|
535
542
|
fill='#ACA0E8'
|
|
536
543
|
/>
|
|
537
|
-
<SvgText x={40} y={59} textAnchor='middle' fontSize={
|
|
538
|
-
|
|
544
|
+
<SvgText x={40} y={59} textAnchor='middle' fontSize={fileIconFontSize(t('MESSAGE_FILE').toUpperCase())} fontWeight='700' fill='#FFFFFF'>
|
|
545
|
+
{t('MESSAGE_FILE').toUpperCase()}
|
|
539
546
|
</SvgText>
|
|
540
547
|
</G>
|
|
541
548
|
</Svg>
|
|
@@ -792,10 +799,10 @@ const ConversationItem = React.memo<ConversationItemProps>((
|
|
|
792
799
|
>
|
|
793
800
|
{renderLeadingView()}
|
|
794
801
|
<View style={mergedStyles.conversationItemStyle?.contentStyle}>
|
|
795
|
-
<Text style={mergedStyles.conversationItemStyle?.titleStyle} numberOfLines={1}>
|
|
796
|
-
{conversation.getConversationWith().getName()}
|
|
802
|
+
<Text style={[TEXT_START, mergedStyles.conversationItemStyle?.titleStyle]} numberOfLines={1}>
|
|
803
|
+
{stripBidiControls(conversation.getConversationWith().getName())}
|
|
797
804
|
</Text>
|
|
798
|
-
<Text style={mergedStyles.conversationItemStyle?.subtitleStyle} numberOfLines={2}>
|
|
805
|
+
<Text style={[TEXT_START, mergedStyles.conversationItemStyle?.subtitleStyle]} numberOfLines={2}>
|
|
799
806
|
{formatPreviewText((conversation.getLastMessage())?.getText?.(), conversation.getLastMessage(), textFormatters)}
|
|
800
807
|
</Text>
|
|
801
808
|
</View>
|
|
@@ -846,13 +853,17 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
846
853
|
audioMessageItemView,
|
|
847
854
|
videoMessageItemView,
|
|
848
855
|
documentMessageItemView,
|
|
849
|
-
linkMessageItemView
|
|
856
|
+
linkMessageItemView,
|
|
857
|
+
layoutDirection,
|
|
850
858
|
}) => {
|
|
859
|
+
// ENG-41333: own setting → enclosing component → global; drives the root and the context.
|
|
860
|
+
const direction = useComponentLayoutDirection(layoutDirection);
|
|
851
861
|
const [searchState, dispatch] = useReducer(searchStateReducer, initialState);
|
|
852
862
|
const [searchValue, setSearchValue] = useState("");
|
|
853
863
|
const [loggedInUser, setLoggedInUser] = useState<CometChat.User | null>(null);
|
|
854
864
|
|
|
855
865
|
const theme = useTheme();
|
|
866
|
+
const inputAlign = useInputTextAlign(); // ENG-41384
|
|
856
867
|
const errorHandler = useCometChatErrorHandler(onError);
|
|
857
868
|
const timeoutIdRef = useRef<any | null>(null);
|
|
858
869
|
const searchInputRef = useRef<React.ComponentRef<typeof TextInput>>(null);
|
|
@@ -948,7 +959,7 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
948
959
|
<View style={[mergedStyles.searchInputContainerStyle]}>
|
|
949
960
|
<TextInput
|
|
950
961
|
ref={searchInputRef}
|
|
951
|
-
style={[mergedStyles.searchInputStyle]}
|
|
962
|
+
style={[inputAlign, mergedStyles.searchInputStyle]}
|
|
952
963
|
value={searchValue}
|
|
953
964
|
onChangeText={handleSearch}
|
|
954
965
|
placeholder={searchPlaceholder}
|
|
@@ -958,7 +969,7 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
958
969
|
<TouchableOpacity
|
|
959
970
|
style={[mergedStyles.clearButtonStyle]}
|
|
960
971
|
onPress={handleClearSearch}
|
|
961
|
-
accessibilityLabel="
|
|
972
|
+
accessibilityLabel={t("CLEAR_SEARCH")}
|
|
962
973
|
>
|
|
963
974
|
<Icon
|
|
964
975
|
name='close'
|
|
@@ -1667,19 +1678,7 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
1667
1678
|
const firstName =
|
|
1668
1679
|
atts[0]?.getName?.() || (message.getAttachment?.() as any)?.getName?.() || "";
|
|
1669
1680
|
|
|
1670
|
-
|
|
1671
|
-
// key back, which is why the counts rendered as "1 IMAGE"/"7 IMAGES").
|
|
1672
|
-
const plural =
|
|
1673
|
-
type === "video" ? "Videos"
|
|
1674
|
-
: type === "image" ? "Images"
|
|
1675
|
-
: type === "audio" ? "Audios"
|
|
1676
|
-
: "Files";
|
|
1677
|
-
const singular =
|
|
1678
|
-
type === "video" ? "Video"
|
|
1679
|
-
: type === "image" ? "Image"
|
|
1680
|
-
: type === "audio" ? "Audio"
|
|
1681
|
-
: "File";
|
|
1682
|
-
const countLabel = `${count} ${count === 1 ? singular : plural}`;
|
|
1681
|
+
const countLabel = mediaCountLabel(type, count);
|
|
1683
1682
|
|
|
1684
1683
|
const hasThumbnail = type === "image" || type === "video"; // +N lives on the thumbnail
|
|
1685
1684
|
const result = hasThumbnail
|
|
@@ -1740,7 +1739,7 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
1740
1739
|
};
|
|
1741
1740
|
const renderMessageSubtitle = (message: CometChat.BaseMessage) => {
|
|
1742
1741
|
const sentByMe = message.getSender?.()?.getUid?.() === loggedInUser?.getUid?.();
|
|
1743
|
-
const
|
|
1742
|
+
const senderName = sentByMe ? t("YOU") || "You" : message.getSender()?.getName?.() || "";
|
|
1744
1743
|
const iconName = attachmentSubtitleIcon[message.getType()];
|
|
1745
1744
|
return (
|
|
1746
1745
|
<View style={styles.row}>
|
|
@@ -1748,10 +1747,11 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
1748
1747
|
overridden here — otherwise the short sender name sits inside a 90%-wide box, leaving a
|
|
1749
1748
|
big gap before the icon and shoving the caption off-screen. Sender hugs its own text
|
|
1750
1749
|
(flexGrow:0) and only ellipsizes (flexShrink:2) when a name is genuinely long. */}
|
|
1751
|
-
<
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1750
|
+
<SenderLabel
|
|
1751
|
+
name={senderName}
|
|
1752
|
+
textStyle={mergedStyles.messageItemStyle?.subtitleStyle}
|
|
1753
|
+
containerStyle={{ flexGrow: 0, flexShrink: 2 }}
|
|
1754
|
+
/>
|
|
1755
1755
|
{iconName ? (
|
|
1756
1756
|
<Icon
|
|
1757
1757
|
name={iconName as any}
|
|
@@ -1763,8 +1763,9 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
1763
1763
|
) : null}
|
|
1764
1764
|
<Text
|
|
1765
1765
|
style={[
|
|
1766
|
+
TEXT_START, // ENG-41391: flex:1 reaches the far edge; iOS would put English text there.
|
|
1766
1767
|
mergedStyles.messageItemStyle?.subtitleStyle,
|
|
1767
|
-
{
|
|
1768
|
+
{ marginStart: iconName ? 4 : 0, width: undefined, flex: 1 },
|
|
1768
1769
|
]}
|
|
1769
1770
|
numberOfLines={1}
|
|
1770
1771
|
ellipsizeMode="tail"
|
|
@@ -1931,7 +1932,7 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
1931
1932
|
|
|
1932
1933
|
// Helper to format date for headers
|
|
1933
1934
|
const getDateHeaderDate = useCallback((timestamp: number) => {
|
|
1934
|
-
return
|
|
1935
|
+
return monthHeaderLabel(timestamp);
|
|
1935
1936
|
}, []);
|
|
1936
1937
|
|
|
1937
1938
|
/** "No results found": the app's own empty view, or the kit's. */
|
|
@@ -2133,7 +2134,7 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
2133
2134
|
const renderCombinedItem = ({ item }: { item: ListItem }) => {
|
|
2134
2135
|
switch (item.type) {
|
|
2135
2136
|
case 'conversation-header':
|
|
2136
|
-
return <Text style={mergedStyles.sectionTitleStyle}>{t("CHATS") || "Chats"}</Text>;
|
|
2137
|
+
return <Text style={[TEXT_START, mergedStyles.sectionTitleStyle]}>{t("CHATS") || "Chats"}</Text>;
|
|
2137
2138
|
|
|
2138
2139
|
case 'conversation':
|
|
2139
2140
|
return (
|
|
@@ -2162,7 +2163,7 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
2162
2163
|
);
|
|
2163
2164
|
|
|
2164
2165
|
case 'message-header':
|
|
2165
|
-
return <Text style={mergedStyles.sectionTitleStyle}>{t("MESSAGES") || "Messages"}</Text>;
|
|
2166
|
+
return <Text style={[TEXT_START, mergedStyles.sectionTitleStyle]}>{t("MESSAGES") || "Messages"}</Text>;
|
|
2166
2167
|
|
|
2167
2168
|
case 'message': {
|
|
2168
2169
|
const message = item.data;
|
|
@@ -2183,7 +2184,7 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
2183
2184
|
timeStamp={sentAt * 1000}
|
|
2184
2185
|
customDateString={currentDateStr}
|
|
2185
2186
|
style={{
|
|
2186
|
-
textStyle: mergedStyles.sectionTitleStyle
|
|
2187
|
+
textStyle: { ...TEXT_START, ...mergedStyles.sectionTitleStyle }
|
|
2187
2188
|
}}
|
|
2188
2189
|
/>
|
|
2189
2190
|
);
|
|
@@ -2241,8 +2242,8 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
2241
2242
|
mergedStyles.messageItemStyle?.contentStyle,
|
|
2242
2243
|
(message.getType() === 'image' || message.getType() === 'video') && mergedStyles.messageItemStyle?.textContainerStyle
|
|
2243
2244
|
]}>
|
|
2244
|
-
<Text style={mergedStyles.messageItemStyle?.titleStyle} numberOfLines={1}>
|
|
2245
|
-
{getMessageChatTitle(message)}
|
|
2245
|
+
<Text style={[TEXT_START, mergedStyles.messageItemStyle?.titleStyle]} numberOfLines={1}>
|
|
2246
|
+
{stripBidiControls(getMessageChatTitle(message))}
|
|
2246
2247
|
</Text>
|
|
2247
2248
|
{renderMessageSubtitle(message)}
|
|
2248
2249
|
</View>
|
|
@@ -2282,11 +2283,13 @@ export const CometChatSearch: React.FC<CometChatSearchProps> = ({
|
|
|
2282
2283
|
};
|
|
2283
2284
|
|
|
2284
2285
|
return (
|
|
2285
|
-
<
|
|
2286
|
+
<LayoutDirectionContext.Provider value={direction}>
|
|
2287
|
+
<View style={[mergedStyles.containerStyle, directionStyle(direction)]}>
|
|
2286
2288
|
{renderHeader()}
|
|
2287
2289
|
{renderFilters()}
|
|
2288
2290
|
{renderResults()}
|
|
2289
2291
|
</View>
|
|
2292
|
+
</LayoutDirectionContext.Provider>
|
|
2290
2293
|
);
|
|
2291
2294
|
};
|
|
2292
2295
|
|
|
@@ -2301,7 +2304,7 @@ const styles = StyleSheet.create({
|
|
|
2301
2304
|
statusBadge: {
|
|
2302
2305
|
position: 'absolute',
|
|
2303
2306
|
bottom: 0,
|
|
2304
|
-
|
|
2307
|
+
end: 0,
|
|
2305
2308
|
},
|
|
2306
2309
|
centerFill: {
|
|
2307
2310
|
flex: 1,
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
339
|
+
marginStart: spacing.margin.m2,
|
|
340
340
|
minHeight: spacing.spacing.s12,
|
|
341
341
|
},
|
|
342
342
|
previewContainerStyle: {
|
|
@@ -23,6 +23,8 @@ 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";
|
|
26
28
|
import { OfflineHub } from "../shared/offline/OfflineHub";
|
|
27
29
|
import { createThreadReplyTracker } from "../shared/offline/threadReplies";
|
|
28
30
|
|
|
@@ -37,6 +39,8 @@ const uiEventId = "ccUiEvent" + Date.now() + "_" + (++__listenerIdCounter);
|
|
|
37
39
|
* @interface CometChatThreadHeaderInterface
|
|
38
40
|
*/
|
|
39
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";
|
|
40
44
|
/**
|
|
41
45
|
* The parent message for the thread. It is a CometChat BaseMessage object.
|
|
42
46
|
*
|
|
@@ -129,6 +133,8 @@ export const CometChatThreadHeader = (props: CometChatThreadHeaderInterface): JS
|
|
|
129
133
|
avatarVisibility = true,
|
|
130
134
|
TrailingView,
|
|
131
135
|
} = props;
|
|
136
|
+
// ENG-41333: own setting → enclosing component → global; drives the root and the context.
|
|
137
|
+
const direction = useComponentLayoutDirection(props.layoutDirection);
|
|
132
138
|
const [message, setMessage] = useState<CometChat.BaseMessage>(parentMessage);
|
|
133
139
|
const [replyCount, setReplyCount] = useState<number>(parentMessage.getReplyCount() || 0);
|
|
134
140
|
// Offline (ON path) reply-count adjustments (README §3.9); inert with offline off.
|
|
@@ -144,7 +150,7 @@ export const CometChatThreadHeader = (props: CometChatThreadHeaderInterface): JS
|
|
|
144
150
|
);
|
|
145
151
|
|
|
146
152
|
const theme = useTheme();
|
|
147
|
-
const { t } = useCometChatTranslation();
|
|
153
|
+
const { t, language } = useCometChatTranslation();
|
|
148
154
|
const style = useMemo(() => deepMerge(theme.threadHeaderStyles, props.style ?? {}), [theme, props.style]);
|
|
149
155
|
|
|
150
156
|
/**
|
|
@@ -290,7 +296,8 @@ export const CometChatThreadHeader = (props: CometChatThreadHeaderInterface): JS
|
|
|
290
296
|
}, [message]);
|
|
291
297
|
|
|
292
298
|
return (
|
|
293
|
-
<
|
|
299
|
+
<LayoutDirectionContext.Provider value={direction}>
|
|
300
|
+
<View style={[style?.containerStyle, directionStyle(direction)]}>
|
|
294
301
|
<ScrollView style={style?.messageBubbleContainerStyle}>
|
|
295
302
|
<View pointerEvents={hasUrl ? 'auto' : 'none'}>
|
|
296
303
|
{MessageUtils.getMessageView({
|
|
@@ -317,16 +324,13 @@ export const CometChatThreadHeader = (props: CometChatThreadHeaderInterface): JS
|
|
|
317
324
|
{replyCountBarVisibility && (
|
|
318
325
|
<View style={[style?.replyCountBarStyle, staticStyles.replyCountBarRow]}>
|
|
319
326
|
<Text style={style?.replyCountTextStyle}>
|
|
320
|
-
{replyCountVisibility
|
|
321
|
-
? replyCount.toString() +
|
|
322
|
-
" " +
|
|
323
|
-
(replyCount == 1 ? t("REPLY") : t("REPLIES"))
|
|
324
|
-
: ""}
|
|
327
|
+
{replyCountVisibility ? pluralCountLabel(t, "REPLY_COUNT", replyCount, language) : ""}
|
|
325
328
|
</Text>
|
|
326
329
|
{TrailingView && <TrailingView parentMessage={message} />}
|
|
327
330
|
</View>
|
|
328
331
|
)}
|
|
329
332
|
</View>
|
|
333
|
+
</LayoutDirectionContext.Provider>
|
|
330
334
|
);
|
|
331
335
|
};
|
|
332
336
|
|
|
@@ -39,9 +39,9 @@ const styles = StyleSheet.create({
|
|
|
39
39
|
flexDirection: "row",
|
|
40
40
|
alignItems: "center",
|
|
41
41
|
height: 56,
|
|
42
|
-
|
|
42
|
+
paddingStart: 15,
|
|
43
43
|
},
|
|
44
|
-
iconContainer: {
|
|
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
|
-
<
|
|
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}
|
|
@@ -545,5 +551,6 @@ export const CometChatUsers = React.forwardRef<
|
|
|
545
551
|
</View>
|
|
546
552
|
)}
|
|
547
553
|
</View>
|
|
554
|
+
</LayoutDirectionContext.Provider>
|
|
548
555
|
);
|
|
549
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
|
-
|
|
82
|
+
paddingStart: spacing.spacing.s3,
|
|
83
83
|
margin: spacing.spacing.s0,
|
|
84
84
|
},
|
|
85
85
|
titleStyle: {
|
|
@@ -27,6 +27,7 @@ import { CallingPackage } from "../CallingPackage";
|
|
|
27
27
|
import { isQuietRejection } from "../../shared/offline/send";
|
|
28
28
|
import { isOfflineOn, sdkConnected } from "../../shared/offline/gate";
|
|
29
29
|
import { JSX } from "react";
|
|
30
|
+
import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection } from "../../shared/helper/layoutDirection";
|
|
30
31
|
|
|
31
32
|
const CometChatCalls = CallingPackage.CometChatCalls;
|
|
32
33
|
|
|
@@ -38,6 +39,8 @@ const listenerId = "callEventListener_" + Date.now() + "_" + (++__listenerIdCoun
|
|
|
38
39
|
* @interface CometChatCallButtonsInterface
|
|
39
40
|
*/
|
|
40
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";
|
|
41
44
|
/**
|
|
42
45
|
* CometChat.User object.
|
|
43
46
|
*/
|
|
@@ -103,6 +106,8 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface): JSX.
|
|
|
103
106
|
outgoingCallConfiguration,
|
|
104
107
|
style = {},
|
|
105
108
|
} = props;
|
|
109
|
+
// ENG-41333: own setting → enclosing component → global; drives the root and the context.
|
|
110
|
+
const direction = useComponentLayoutDirection(props.layoutDirection);
|
|
106
111
|
|
|
107
112
|
const theme = useTheme();
|
|
108
113
|
const compTheme = useCompTheme();
|
|
@@ -315,7 +320,8 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface): JSX.
|
|
|
315
320
|
}, []);
|
|
316
321
|
|
|
317
322
|
return (
|
|
318
|
-
<
|
|
323
|
+
<LayoutDirectionContext.Provider value={direction}>
|
|
324
|
+
<View style={[callButtonStyles.containerStyle as ViewStyle, directionStyle(direction)]}>
|
|
319
325
|
{!hideVoiceCallButton && (
|
|
320
326
|
<TouchableOpacity onPress={() => makeVoiceCall()}>
|
|
321
327
|
<Icon
|
|
@@ -370,5 +376,6 @@ export const CometChatCallButtons = (props: CometChatCallButtonsInterface): JSX.
|
|
|
370
376
|
/>
|
|
371
377
|
)}
|
|
372
378
|
</View>
|
|
379
|
+
</LayoutDirectionContext.Provider>
|
|
373
380
|
);
|
|
374
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
|
-
|
|
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
|
-
|
|
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} />
|