@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.
- 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/FileManager.java +78 -3
- 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/android/src/main/java/com/reactnativecometchatuikit/SafeFileName.java +78 -0
- package/ios/CCLocalFileGuard.h +19 -0
- package/ios/CCLocalFileGuard.m +34 -0
- package/ios/CometChatKeyboardModule.m +9 -0
- package/ios/CometChatKeyboardModule.swift +71 -0
- package/ios/FileManager.m +70 -6
- package/ios/KeyboardLanguageDirection.swift +24 -0
- package/ios/RichTextEditorView.swift +253 -51
- package/ios/RichTextEditorViewManager.m +1 -0
- package/ios/VideoManager.m +1 -1
- package/package.json +18 -3
- 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 +145 -63
- package/src/CometChatCompactMessageComposer/styles.ts +7 -7
- package/src/CometChatConversations/CometChatConversations.tsx +276 -147
- package/src/CometChatConversations/Skeleton.tsx +4 -1
- package/src/CometChatConversations/style.ts +1 -1
- package/src/CometChatGroupMembers/CometChatGroupMembers.tsx +39 -18
- package/src/CometChatGroupMembers/Skeleton.tsx +4 -1
- package/src/CometChatGroupMembers/style.ts +6 -4
- package/src/CometChatGroups/CometChatGroups.tsx +74 -58
- package/src/CometChatGroups/GroupsStyle.ts +1 -1
- package/src/CometChatGroups/Skeleton.tsx +4 -1
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +190 -96
- package/src/CometChatMessageComposer/styles.tsx +1 -1
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +28 -15
- package/src/CometChatMessageHeader/listners.ts +76 -56
- package/src/CometChatMessageInformation/CometChatMessageInformation.tsx +8 -1
- package/src/CometChatMessageInformation/Skeleton.tsx +4 -1
- package/src/CometChatMessageList/CometChatMessageList.tsx +1465 -313
- 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 +81 -10
- package/src/CometChatNotificationFeed/style.ts +1 -1
- package/src/CometChatNotificationFeed/utils.ts +17 -18
- package/src/CometChatPinnedMessages/CometChatPinnedMessages.tsx +82 -3
- 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 +83 -15
- package/src/CometChatSavedMessages/style.ts +3 -3
- package/src/CometChatSearch/CometChatSearch.tsx +391 -136
- 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 +34 -8
- package/src/CometChatThreadHeader/Header.tsx +2 -2
- package/src/CometChatUsers/CometChatUsers.tsx +10 -1
- package/src/CometChatUsers/Skeleton.tsx +4 -1
- package/src/CometChatUsers/style.ts +1 -1
- package/src/calls/CometChatCallButtons/CometChatCallButtons.tsx +27 -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 +4 -2
- package/src/index.ts +11 -1
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +102 -2
- package/src/shared/CometChatUiKit/UIKitSettings.ts +28 -0
- package/src/shared/events/CometChatUIEventHandler/Listener.ts +10 -0
- package/src/shared/events/index.ts +4 -0
- package/src/shared/events/offline.ts +28 -0
- package/src/shared/formatters/CometChatMentionsFormatter/CometChatMentionsFormatter.tsx +18 -13
- 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 +51 -108
- 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/index.ts +2 -0
- package/src/shared/offline/OfflineHub.ts +651 -0
- package/src/shared/offline/OfflineMediaBubble.tsx +49 -0
- package/src/shared/offline/OfflineViews.tsx +222 -0
- package/src/shared/offline/conversationPins.ts +137 -0
- package/src/shared/offline/conversations.ts +325 -0
- package/src/shared/offline/frameProbe.ts +24 -0
- package/src/shared/offline/gate.ts +94 -0
- package/src/shared/offline/groupActions.ts +81 -0
- package/src/shared/offline/identity.ts +162 -0
- package/src/shared/offline/index.ts +76 -0
- package/src/shared/offline/media.ts +247 -0
- package/src/shared/offline/notices.ts +84 -0
- package/src/shared/offline/reconcile.ts +296 -0
- package/src/shared/offline/searchOutcome.ts +62 -0
- package/src/shared/offline/send.ts +430 -0
- package/src/shared/offline/stateContract.ts +85 -0
- package/src/shared/offline/threadReplies.ts +125 -0
- package/src/shared/offline/twoPhase.ts +372 -0
- package/src/shared/offline/unsentActions.ts +168 -0
- package/src/shared/offline/useOfflineMediaUri.ts +87 -0
- package/src/shared/offline/useOfflineReconnect.ts +25 -0
- package/src/shared/offline/useOfflineSessionEnded.ts +22 -0
- package/src/shared/offline/useOfflineUploadTray.ts +76 -0
- package/src/shared/offline/usePresenceHidden.ts +33 -0
- 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 +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +75 -4
- package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +75 -4
- package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +82 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +90 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +74 -3
- package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +74 -3
- package/src/shared/services/UploadQueueService.ts +106 -1
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +13 -12
- package/src/shared/utils/CometChatMessagePreview/style.ts +1 -1
- package/src/shared/utils/MessageReceiptUtils.ts +8 -0
- package/src/shared/utils/MessageUtils.tsx +14 -14
- package/src/shared/utils/PermissionUtil.ts +16 -5
- package/src/shared/utils/SavedMessagesHelper.ts +18 -1
- package/src/shared/utils/attachmentLimits.ts +3 -2
- package/src/shared/utils/catchUpCursor.ts +36 -0
- package/src/shared/utils/conversationUtils.ts +3 -5
- package/src/shared/utils/failedMessageRetry.ts +73 -0
- 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/utils/messageIdentity.ts +38 -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 +45 -12
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +16 -10
- package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +20 -8
- 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/CometChatFileBubble/CometChatFileBubble.tsx +13 -27
- package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +65 -15
- package/src/shared/views/CometChatImageViewerModal/ImageViewerModal.tsx +7 -3
- package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +56 -25
- 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 +478 -21
- 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 +43 -16
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +24 -4
- package/src/shared/views/CometChatMessageInput/CometChatMessageInput.tsx +19 -2
- package/src/shared/views/CometChatNewMessageIndicator/CometChatNewMessageIndicator.tsx +3 -2
- package/src/shared/views/CometChatReactionList/CometChatReactionList.tsx +59 -12
- 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/CometChatStatusIndicator/CometChatStatusIndicator.tsx +4 -0
- 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 +58 -24
- package/src/shared/views/CometChatVoiceNoteBubble/CometChatVoiceNoteBubble.tsx +24 -12
- package/src/shared/views/SenderLabel.tsx +41 -0
- package/src/theme/default/default.ts +1 -1
- package/src/theme/type.ts +17 -0
- package/android/.gradle/7.4/checksums/checksums.lock +0 -0
- package/android/.gradle/7.4/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.4/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.4/gc.properties +0 -0
- 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 "../theme";
|
|
19
19
|
import { CometChatTheme } from "../theme/type";
|
|
20
|
+
import { useRtlMirror } from "../shared/helper/layoutDirection";
|
|
20
21
|
|
|
21
22
|
// ───────────────────────────────────────────────────────────────
|
|
22
23
|
// Consts & Types
|
|
@@ -112,6 +113,8 @@ const SkeletonItemTop: React.FC<SkeletonProps> = ({ style }) => {
|
|
|
112
113
|
// ───────────────────────────────────────────────────────────────
|
|
113
114
|
export const Skeleton: React.FC<SkeletonProps> = ({ style }) => {
|
|
114
115
|
const theme = useTheme();
|
|
116
|
+
// ENG-41390: SVG shapes and the shimmer use fixed x positions; flip the whole skeleton in RTL.
|
|
117
|
+
const rtlMirror = useRtlMirror();
|
|
115
118
|
const animatedValue = useRef(new Animated.Value(0)).current;
|
|
116
119
|
|
|
117
120
|
/* Kick-off the shimmer animation once on mount */
|
|
@@ -135,7 +138,7 @@ export const Skeleton: React.FC<SkeletonProps> = ({ style }) => {
|
|
|
135
138
|
|
|
136
139
|
/* Render ----------------------------------------------------- */
|
|
137
140
|
return (
|
|
138
|
-
<ScrollView showsVerticalScrollIndicator={false} scrollEnabled={false}>
|
|
141
|
+
<ScrollView style={rtlMirror} showsVerticalScrollIndicator={false} scrollEnabled={false}>
|
|
139
142
|
{/* Bottom layer rectangles */}
|
|
140
143
|
{Array.from({ length: SKELETON_ROW_COUNT }, (_, i) => (
|
|
141
144
|
<SkeletonItemBottom style={style} key={`bottom-${i}`} />
|
|
@@ -19,6 +19,7 @@ import { CometChat } from "@cometchat/chat-sdk-react-native";
|
|
|
19
19
|
import { CometChatList, CometChatListProps } from "../shared";
|
|
20
20
|
import { MessageTypeConstants } from "../shared/constants/UIKitConstants";
|
|
21
21
|
import { deepMerge } from "../shared/helper/helperFunctions";
|
|
22
|
+
import { sentenceWithNames } from "../shared/helper/textDirection";
|
|
22
23
|
import { DeepPartial } from "../shared/helper/types";
|
|
23
24
|
import { Icon } from "../shared/icons/Icon";
|
|
24
25
|
import {
|
|
@@ -28,6 +29,7 @@ import {
|
|
|
28
29
|
import { CometChatStatusIndicatorInterface } from "../shared/views/CometChatStatusIndicator";
|
|
29
30
|
import { CometChatTooltipMenu } from "../shared/views/CometChatTooltipMenu";
|
|
30
31
|
import { ErrorEmptyView } from "../shared/views/ErrorEmptyView/ErrorEmptyView";
|
|
32
|
+
import { OFFLINE_STRING_KEYS } from "../shared/offline/notices";
|
|
31
33
|
import { useTheme } from "../theme";
|
|
32
34
|
import { Skeleton } from "./Skeleton";
|
|
33
35
|
import { GroupMemberStyle } from "./style";
|
|
@@ -37,6 +39,7 @@ import Block from "../shared/icons/components/block";
|
|
|
37
39
|
import Cancel from "../shared/icons/components/cancel";
|
|
38
40
|
import { JSX } from "react";
|
|
39
41
|
import { useCometChatTranslation } from "../shared/resources/CometChatLocalizeNew";
|
|
42
|
+
import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection } from "../shared/helper/layoutDirection";
|
|
40
43
|
|
|
41
44
|
/**
|
|
42
45
|
* Props for the CometChatGroupMembers component.
|
|
@@ -62,6 +65,8 @@ export interface CometChatGroupMembersInterface
|
|
|
62
65
|
| "statusIndicatorType"
|
|
63
66
|
| "hideStickyHeader"
|
|
64
67
|
> {
|
|
68
|
+
/** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
|
|
69
|
+
layoutDirection?: "ltr" | "rtl";
|
|
65
70
|
/**
|
|
66
71
|
* Custom view for subtitle.
|
|
67
72
|
* @param item - Object of CometChat.GroupMember.
|
|
@@ -250,6 +255,8 @@ export const CometChatGroupMembers = (props: CometChatGroupMembersInterface) =>
|
|
|
250
255
|
hideSubmitButton = false,
|
|
251
256
|
...newProps
|
|
252
257
|
} = props;
|
|
258
|
+
// ENG-41333: own setting → enclosing component → global; drives the root and the context.
|
|
259
|
+
const direction = useComponentLayoutDirection(props.layoutDirection);
|
|
253
260
|
|
|
254
261
|
// Get theme information and merge with provided style overrides.
|
|
255
262
|
const theme = useTheme();
|
|
@@ -623,7 +630,8 @@ export const CometChatGroupMembers = (props: CometChatGroupMembersInterface) =>
|
|
|
623
630
|
};
|
|
624
631
|
|
|
625
632
|
return (
|
|
626
|
-
<
|
|
633
|
+
<LayoutDirectionContext.Provider value={direction}>
|
|
634
|
+
<View style={[mergedStyle.containerStyle as ViewStyle, directionStyle(direction)]}>
|
|
627
635
|
<CometChatList
|
|
628
636
|
ref={listRef}
|
|
629
637
|
hideHeader={hideHeader}
|
|
@@ -658,7 +666,10 @@ export const CometChatGroupMembers = (props: CometChatGroupMembersInterface) =>
|
|
|
658
666
|
: () => <Skeleton />
|
|
659
667
|
}
|
|
660
668
|
EmptyView={EmptyView ? EmptyView : () => <EmptyStateView />}
|
|
669
|
+
customEmptyView={!!EmptyView}
|
|
670
|
+
connectToLoadKey={OFFLINE_STRING_KEYS.connectToLoadMembers}
|
|
661
671
|
ErrorView={ErrorView ? ErrorView : () => <ErrorStateView />}
|
|
672
|
+
customErrorView={!!ErrorView}
|
|
662
673
|
statusIndicatorType={(user: CometChat.User) =>
|
|
663
674
|
usersStatusVisibility
|
|
664
675
|
? (user?.getStatus() as CometChatStatusIndicatorInterface["type"])
|
|
@@ -823,6 +834,8 @@ export const CometChatGroupMembers = (props: CometChatGroupMembersInterface) =>
|
|
|
823
834
|
<TouchableOpacity
|
|
824
835
|
key={role.value}
|
|
825
836
|
activeOpacity={isDisabled ? 1 : 0.7}
|
|
837
|
+
accessibilityRole="radio"
|
|
838
|
+
accessibilityState={{ checked: selectedRole === role.value, disabled: isDisabled }}
|
|
826
839
|
onPress={() => {
|
|
827
840
|
if (!isDisabled) {
|
|
828
841
|
setSelectedRole(role.value);
|
|
@@ -833,14 +846,7 @@ export const CometChatGroupMembers = (props: CometChatGroupMembersInterface) =>
|
|
|
833
846
|
mergedStyle?.changeScope?.actionListStyle,
|
|
834
847
|
]}
|
|
835
848
|
>
|
|
836
|
-
|
|
837
|
-
style={[
|
|
838
|
-
theme.typography.heading4.medium,
|
|
839
|
-
{ color: theme.color.textPrimary },
|
|
840
|
-
]}
|
|
841
|
-
>
|
|
842
|
-
{role.display}
|
|
843
|
-
</Text>
|
|
849
|
+
{/* Android ENG-57439 / design: the radio at the start of the row, then the name. */}
|
|
844
850
|
<View
|
|
845
851
|
style={{
|
|
846
852
|
height: 24,
|
|
@@ -863,6 +869,15 @@ export const CometChatGroupMembers = (props: CometChatGroupMembersInterface) =>
|
|
|
863
869
|
/>
|
|
864
870
|
)}
|
|
865
871
|
</View>
|
|
872
|
+
<Text
|
|
873
|
+
style={[
|
|
874
|
+
theme.typography.heading4.medium,
|
|
875
|
+
// A long translated role name wraps beside the radio instead of overflowing.
|
|
876
|
+
{ color: theme.color.textPrimary, flexShrink: 1 },
|
|
877
|
+
]}
|
|
878
|
+
>
|
|
879
|
+
{role.display}
|
|
880
|
+
</Text>
|
|
866
881
|
</TouchableOpacity>
|
|
867
882
|
);
|
|
868
883
|
})}
|
|
@@ -981,6 +996,8 @@ export const CometChatGroupMembers = (props: CometChatGroupMembersInterface) =>
|
|
|
981
996
|
{modalType && (
|
|
982
997
|
<View
|
|
983
998
|
style={{
|
|
999
|
+
// Modal content is a new native root: re-apply this component's direction.
|
|
1000
|
+
...directionStyle(direction),
|
|
984
1001
|
...(modalType === "ban"
|
|
985
1002
|
? mergedStyle.banModalStyle?.containerStyle
|
|
986
1003
|
: mergedStyle.removeModalStyle?.containerStyle),
|
|
@@ -993,8 +1010,9 @@ export const CometChatGroupMembers = (props: CometChatGroupMembersInterface) =>
|
|
|
993
1010
|
: mergedStyle.removeModalStyle?.iconContainerStyle),
|
|
994
1011
|
}}
|
|
995
1012
|
>
|
|
1013
|
+
{/* ENG-57318: the design's icons: plain ✕ for Kick, ⊘ for Ban (as the long-press menu). */}
|
|
996
1014
|
<Icon
|
|
997
|
-
name=
|
|
1015
|
+
name={modalType === "ban" ? "block" : "close"}
|
|
998
1016
|
icon={
|
|
999
1017
|
modalType === "ban"
|
|
1000
1018
|
? mergedStyle.banModalStyle?.icon
|
|
@@ -1030,9 +1048,8 @@ export const CometChatGroupMembers = (props: CometChatGroupMembersInterface) =>
|
|
|
1030
1048
|
: mergedStyle.removeModalStyle?.titleTextStyle
|
|
1031
1049
|
}
|
|
1032
1050
|
>
|
|
1033
|
-
{
|
|
1034
|
-
|
|
1035
|
-
: `${t("KICK")} ${selectedItem.getName()} ?`}
|
|
1051
|
+
{/* ENG-57318: the design's Kick / Ban Member titles; they name no member. */}
|
|
1052
|
+
{modalType === "ban" ? t("BAN_MEMBER_TITLE") : t("KICK_MEMBER_TITLE")}
|
|
1036
1053
|
</Text>
|
|
1037
1054
|
|
|
1038
1055
|
<Text
|
|
@@ -1042,9 +1059,12 @@ export const CometChatGroupMembers = (props: CometChatGroupMembersInterface) =>
|
|
|
1042
1059
|
: mergedStyle.removeModalStyle?.subTitleTextStyle
|
|
1043
1060
|
}
|
|
1044
1061
|
>
|
|
1045
|
-
{
|
|
1046
|
-
|
|
1047
|
-
|
|
1062
|
+
{/* ENG-57318: one whole translated sentence with a ${name} slot (as Android),
|
|
1063
|
+
not a prefix glued to the name, which ran into the Arabic word. */}
|
|
1064
|
+
{sentenceWithNames(
|
|
1065
|
+
t(modalType === "ban" ? "BAN_MEMBER_CONFIRM_MESSAGE" : "KICK_MEMBER_CONFIRM_MESSAGE"),
|
|
1066
|
+
{ name: selectedItem.getName() }
|
|
1067
|
+
)}
|
|
1048
1068
|
</Text>
|
|
1049
1069
|
|
|
1050
1070
|
<View
|
|
@@ -1069,7 +1089,7 @@ export const CometChatGroupMembers = (props: CometChatGroupMembersInterface) =>
|
|
|
1069
1089
|
: mergedStyle.removeModalStyle?.cancelStyle?.textStyle),
|
|
1070
1090
|
}}
|
|
1071
1091
|
>
|
|
1072
|
-
{t("
|
|
1092
|
+
{t("CANCEL")}
|
|
1073
1093
|
</Text>
|
|
1074
1094
|
</TouchableOpacity>
|
|
1075
1095
|
<TouchableOpacity
|
|
@@ -1095,7 +1115,7 @@ export const CometChatGroupMembers = (props: CometChatGroupMembersInterface) =>
|
|
|
1095
1115
|
: mergedStyle.removeModalStyle?.confirmStyle?.textStyle),
|
|
1096
1116
|
}}
|
|
1097
1117
|
>
|
|
1098
|
-
{t("
|
|
1118
|
+
{modalType === "ban" ? t("BAN") : t("KICK")}
|
|
1099
1119
|
</Text>
|
|
1100
1120
|
</TouchableOpacity>
|
|
1101
1121
|
</View>
|
|
@@ -1107,5 +1127,6 @@ export const CometChatGroupMembers = (props: CometChatGroupMembersInterface) =>
|
|
|
1107
1127
|
</Modal>
|
|
1108
1128
|
|
|
1109
1129
|
</View>
|
|
1130
|
+
</LayoutDirectionContext.Provider>
|
|
1110
1131
|
);
|
|
1111
1132
|
};
|
|
@@ -2,6 +2,7 @@ import React, { useEffect, useRef } from "react";
|
|
|
2
2
|
import { Animated, Dimensions, Easing, ScrollView, StyleSheet, View } from "react-native";
|
|
3
3
|
import Svg, { Circle, Defs, LinearGradient, Rect, Stop } from "react-native-svg";
|
|
4
4
|
import { useTheme } from "../theme";
|
|
5
|
+
import { useRtlMirror } from "../shared/helper/layoutDirection";
|
|
5
6
|
|
|
6
7
|
const { width: screenWidth } = Dimensions.get("window");
|
|
7
8
|
|
|
@@ -108,6 +109,8 @@ const SkeletonItemTop = () => {
|
|
|
108
109
|
|
|
109
110
|
export const Skeleton = () => {
|
|
110
111
|
const theme = useTheme();
|
|
112
|
+
// ENG-41390: SVG shapes and the shimmer use fixed x positions; flip the whole skeleton in RTL.
|
|
113
|
+
const rtlMirror = useRtlMirror();
|
|
111
114
|
const animatedValue = useRef(new Animated.Value(0)).current;
|
|
112
115
|
|
|
113
116
|
useEffect(() => {
|
|
@@ -135,7 +138,7 @@ export const Skeleton = () => {
|
|
|
135
138
|
<ScrollView
|
|
136
139
|
scrollEnabled={false}
|
|
137
140
|
showsVerticalScrollIndicator={false}
|
|
138
|
-
style={{ backgroundColor: theme.groupMemberStyle?.containerStyle?.backgroundColor }}
|
|
141
|
+
style={[{ backgroundColor: theme.groupMemberStyle?.containerStyle?.backgroundColor }, rtlMirror]}
|
|
139
142
|
>
|
|
140
143
|
<SkeletonItemBottom />
|
|
141
144
|
<Animated.View
|
|
@@ -375,7 +375,7 @@ export const getGroupMemberStyleLight = (
|
|
|
375
375
|
},
|
|
376
376
|
confirmStyle: {
|
|
377
377
|
containerStyle: {
|
|
378
|
-
|
|
378
|
+
marginStart: 2,
|
|
379
379
|
flex: 1,
|
|
380
380
|
paddingVertical: 10,
|
|
381
381
|
borderWidth: 1,
|
|
@@ -392,12 +392,14 @@ export const getGroupMemberStyleLight = (
|
|
|
392
392
|
actionListStyle: {
|
|
393
393
|
flexDirection: "row",
|
|
394
394
|
alignItems: "center",
|
|
395
|
-
|
|
395
|
+
// Radio then role name from the start edge (design, Android ENG-57439).
|
|
396
|
+
justifyContent: "flex-start",
|
|
397
|
+
gap: spacing.spacing.s2,
|
|
396
398
|
paddingVertical: 10,
|
|
397
399
|
},
|
|
398
400
|
cancelStyle: {
|
|
399
401
|
containerStyle: {
|
|
400
|
-
|
|
402
|
+
marginEnd: 2,
|
|
401
403
|
flex: 1,
|
|
402
404
|
paddingVertical: 10,
|
|
403
405
|
borderWidth: 1,
|
|
@@ -429,7 +431,7 @@ export const getGroupMemberStyleLight = (
|
|
|
429
431
|
onlineStatusColor: color.success,
|
|
430
432
|
titleViewStyle: {
|
|
431
433
|
paddingVertical: spacing.spacing.s3,
|
|
432
|
-
|
|
434
|
+
paddingStart: spacing.spacing.s3,
|
|
433
435
|
margin: spacing.spacing.s0,
|
|
434
436
|
},
|
|
435
437
|
titleStyle: {
|
|
@@ -20,6 +20,10 @@ import { Skeleton } from "./Skeleton";
|
|
|
20
20
|
import { Style } from "./style";
|
|
21
21
|
import { JSX } from "react";
|
|
22
22
|
import { useCometChatTranslation } from "../shared/resources/CometChatLocalizeNew";
|
|
23
|
+
import { pluralCountLabel } from "../shared/helper/pluralRules";
|
|
24
|
+
import { LayoutDirectionContext, directionStyle, useComponentLayoutDirection, TEXT_START } from "../shared/helper/layoutDirection";
|
|
25
|
+
import { OfflineHub } from "../shared/offline/OfflineHub";
|
|
26
|
+
import { dispatchSweptGroupAction } from "../shared/offline/groupActions";
|
|
23
27
|
|
|
24
28
|
// Unique listener IDs for group events and UI events.
|
|
25
29
|
const groupListenerId = "grouplist_" + Date.now() + "_" + (++__listenerIdCounter);
|
|
@@ -29,6 +33,8 @@ const uiEventListener = "uiEvents_" + Date.now() + "_" + (++__listenerIdCounter)
|
|
|
29
33
|
* Props for the CometChatGroups component.
|
|
30
34
|
*/
|
|
31
35
|
export interface CometChatGroupsInterface {
|
|
36
|
+
/** Lays this component out `"ltr"` or `"rtl"`, overriding the kit's global `layoutDirection`. Not set = inherit. */
|
|
37
|
+
layoutDirection?: "ltr" | "rtl";
|
|
32
38
|
/**
|
|
33
39
|
* Custom title view for a group item.
|
|
34
40
|
* @param group - The group object.
|
|
@@ -179,7 +185,7 @@ export interface CometChatGroupsInterface {
|
|
|
179
185
|
* error/empty/loading views, and a long-press tooltip menu (if you provide menu items).
|
|
180
186
|
*/
|
|
181
187
|
export const CometChatGroups = React.forwardRef((props: CometChatGroupsInterface, ref: any) => {
|
|
182
|
-
const { t } = useCometChatTranslation();
|
|
188
|
+
const { t, language } = useCometChatTranslation();
|
|
183
189
|
|
|
184
190
|
const {
|
|
185
191
|
AppBarOptions,
|
|
@@ -212,6 +218,8 @@ export const CometChatGroups = React.forwardRef((props: CometChatGroupsInterface
|
|
|
212
218
|
hideHeader,
|
|
213
219
|
...newProps
|
|
214
220
|
} = props;
|
|
221
|
+
// ENG-41333: own setting → enclosing component → global; drives the root and the context.
|
|
222
|
+
const direction = useComponentLayoutDirection(props.layoutDirection);
|
|
215
223
|
|
|
216
224
|
// Theme references.
|
|
217
225
|
const theme = useTheme();
|
|
@@ -418,58 +426,62 @@ export const CometChatGroups = React.forwardRef((props: CometChatGroupsInterface
|
|
|
418
426
|
* Set up group listeners when the component mounts.
|
|
419
427
|
*/
|
|
420
428
|
useEffect(() => {
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
)
|
|
429
|
+
const groupListenerHandlers = {
|
|
430
|
+
onGroupMemberScopeChanged: (
|
|
431
|
+
message: CometChat.Action,
|
|
432
|
+
changedUser: CometChat.User,
|
|
433
|
+
newScope: CometChat.GroupMemberScope,
|
|
434
|
+
oldScope: CometChat.GroupMemberScope,
|
|
435
|
+
changedGroup: CometChat.Group
|
|
436
|
+
) => {
|
|
437
|
+
handleGroupMemberScopeChange(message, changedUser, newScope, oldScope, changedGroup);
|
|
438
|
+
},
|
|
439
|
+
onGroupMemberKicked: (
|
|
440
|
+
message: CometChat.Action,
|
|
441
|
+
kickedUser: CometChat.User,
|
|
442
|
+
kickedBy: CometChat.User,
|
|
443
|
+
kickedFrom: CometChat.Group
|
|
444
|
+
) => {
|
|
445
|
+
handleGroupMemberRemoval(message, kickedUser, kickedBy, kickedFrom);
|
|
446
|
+
},
|
|
447
|
+
onGroupMemberLeft: (
|
|
448
|
+
message: CometChat.Action,
|
|
449
|
+
leavingUser: CometChat.User,
|
|
450
|
+
group: CometChat.Group
|
|
451
|
+
) => {
|
|
452
|
+
handleGroupMemberRemoval(message, leavingUser, null, group);
|
|
453
|
+
},
|
|
454
|
+
onGroupMemberBanned: (
|
|
455
|
+
message: CometChat.Action,
|
|
456
|
+
bannedUser: CometChat.User,
|
|
457
|
+
bannedBy: CometChat.User,
|
|
458
|
+
bannedFrom: CometChat.Group
|
|
459
|
+
) => {
|
|
460
|
+
handleGroupMemberBan(message, bannedUser, bannedBy, bannedFrom);
|
|
461
|
+
},
|
|
462
|
+
onMemberAddedToGroup: (
|
|
463
|
+
message: CometChat.Action,
|
|
464
|
+
userAdded: CometChat.User,
|
|
465
|
+
userAddedBy: CometChat.User,
|
|
466
|
+
userAddedIn: CometChat.Group
|
|
467
|
+
) => {
|
|
468
|
+
handleGroupMemberAddition(message, userAdded, userAddedBy, userAddedIn);
|
|
469
|
+
},
|
|
470
|
+
onGroupMemberJoined: (
|
|
471
|
+
message: CometChat.Action,
|
|
472
|
+
joinedUser: CometChat.User,
|
|
473
|
+
joinedGroup: CometChat.Group
|
|
474
|
+
) => {
|
|
475
|
+
handleGroupMemberAddition(message, joinedUser, null, joinedGroup);
|
|
476
|
+
},
|
|
477
|
+
};
|
|
478
|
+
CometChat.addGroupListener(groupListenerId, new CometChat.GroupListener(groupListenerHandlers));
|
|
479
|
+
// Offline (ON path): a group action the catch-up sweep delivered fires no GroupListener
|
|
480
|
+
// callback; run the same handlers for it (UIT-SYNC-13). Inert with offline off.
|
|
481
|
+
const sweptGroupActions = OfflineHub.getInstance().groupActionSwept$.subscribe((event) => {
|
|
482
|
+
if (event.gen !== OfflineHub.getInstance().gen) return;
|
|
483
|
+
dispatchSweptGroupAction(event.message, groupListenerHandlers);
|
|
484
|
+
});
|
|
473
485
|
|
|
474
486
|
CometChatUIEventHandler.addGroupListener(uiEventListener, {
|
|
475
487
|
ccGroupCreated: ({ group }: { group: CometChat.Group }) => {
|
|
@@ -509,6 +521,7 @@ export const CometChatGroups = React.forwardRef((props: CometChatGroupsInterface
|
|
|
509
521
|
});
|
|
510
522
|
|
|
511
523
|
return () => {
|
|
524
|
+
sweptGroupActions.unsubscribe();
|
|
512
525
|
CometChat.removeGroupListener(groupListenerId);
|
|
513
526
|
CometChatUIEventHandler.removeGroupListener(uiEventListener);
|
|
514
527
|
};
|
|
@@ -518,15 +531,14 @@ export const CometChatGroups = React.forwardRef((props: CometChatGroupsInterface
|
|
|
518
531
|
const DefaultSubtitleView = useCallback((group: CometChat.Group) => (
|
|
519
532
|
<Text
|
|
520
533
|
style={[
|
|
534
|
+
TEXT_START,
|
|
521
535
|
style.itemStyle?.subtitleStyle,
|
|
522
536
|
theme.groupStyles.itemStyle?.subtitleStyle,
|
|
523
537
|
]}
|
|
524
538
|
>
|
|
525
|
-
{group.getMembersCount()
|
|
526
|
-
" " +
|
|
527
|
-
t(group.getMembersCount() === 1 ? "MEMBER" : "MEMBERS")}
|
|
539
|
+
{pluralCountLabel(t, "MEMBER_COUNT", group.getMembersCount(), language)}
|
|
528
540
|
</Text>
|
|
529
|
-
), [style, theme, t]);
|
|
541
|
+
), [style, theme, t, language]);
|
|
530
542
|
|
|
531
543
|
// Stable onListFetched callback
|
|
532
544
|
const handleListFetched = useCallback((fetchedList: CometChat.GroupMember[]) => {
|
|
@@ -545,7 +557,8 @@ export const CometChatGroups = React.forwardRef((props: CometChatGroupsInterface
|
|
|
545
557
|
);
|
|
546
558
|
|
|
547
559
|
return (
|
|
548
|
-
<
|
|
560
|
+
<LayoutDirectionContext.Provider value={direction}>
|
|
561
|
+
<View style={[Style.container, theme.groupStyles.containerStyle, directionStyle(direction)]}>
|
|
549
562
|
<CometChatList
|
|
550
563
|
hideHeader={hideHeader ?? hideHeader}
|
|
551
564
|
onItemPress={onItemPress}
|
|
@@ -567,7 +580,9 @@ export const CometChatGroups = React.forwardRef((props: CometChatGroupsInterface
|
|
|
567
580
|
: () => <Skeleton style={mergedStyle.skeletonStyle} />
|
|
568
581
|
}
|
|
569
582
|
EmptyView={EmptyView ? EmptyView : () => <EmptyStateView />}
|
|
583
|
+
customEmptyView={!!EmptyView}
|
|
570
584
|
ErrorView={ErrorView ? ErrorView : () => <ErrorStateView />}
|
|
585
|
+
customErrorView={!!ErrorView}
|
|
571
586
|
searchPlaceholderText={searchPlaceholderText}
|
|
572
587
|
ref={groupListRef}
|
|
573
588
|
listItemKey='guid'
|
|
@@ -621,5 +636,6 @@ export const CometChatGroups = React.forwardRef((props: CometChatGroupsInterface
|
|
|
621
636
|
</View>
|
|
622
637
|
)}
|
|
623
638
|
</View>
|
|
639
|
+
</LayoutDirectionContext.Provider>
|
|
624
640
|
);
|
|
625
641
|
});
|
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
import Svg, { Circle, Defs, LinearGradient, Rect, Stop } from "react-native-svg";
|
|
11
11
|
import { useTheme } from "../theme";
|
|
12
12
|
import { CometChatTheme } from "../theme/type";
|
|
13
|
+
import { useRtlMirror } from "../shared/helper/layoutDirection";
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* React‑Native skeleton list with animated shimmer.
|
|
@@ -137,6 +138,8 @@ const useRowShapes = (fill: string) =>
|
|
|
137
138
|
|
|
138
139
|
export const Skeleton: React.FC<SkeletonProps> = ({ style }) => {
|
|
139
140
|
const theme = useTheme();
|
|
141
|
+
// ENG-41390: SVG shapes and the shimmer use fixed x positions; flip the whole skeleton in RTL.
|
|
142
|
+
const rtlMirror = useRtlMirror();
|
|
140
143
|
|
|
141
144
|
/** Resolved style helpers (with theme‑fallback). */
|
|
142
145
|
const get = <K extends keyof SkeletonStyle>(key: K) =>
|
|
@@ -180,7 +183,7 @@ export const Skeleton: React.FC<SkeletonProps> = ({ style }) => {
|
|
|
180
183
|
<ScrollView
|
|
181
184
|
scrollEnabled={false}
|
|
182
185
|
showsVerticalScrollIndicator={false}
|
|
183
|
-
style={{ backgroundColor: get("containerBackgroundColor") }}
|
|
186
|
+
style={[{ backgroundColor: get("containerBackgroundColor") }, rtlMirror]}
|
|
184
187
|
>
|
|
185
188
|
{/* Bottom gradient layer */}
|
|
186
189
|
<Svg height={TOTAL_HEIGHT} width={SCREEN_WIDTH} fill="none" preserveAspectRatio="xMidYMid meet">
|