@cometchat/chat-uikit-react-native 5.3.10 → 5.4.1
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/CometChatClipboardModule.kt +52 -0
- package/android/src/main/java/com/reactnativecometchatuikit/CometchatUiKitPackage.java +1 -0
- package/android/src/main/java/com/reactnativecometchatuikit/FileManager.java +95 -8
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorView.kt +300 -7
- package/android/src/main/java/com/reactnativecometchatuikit/RichTextEditorViewManager.kt +2 -1
- package/android/src/main/java/com/reactnativecometchatuikit/SoundPlayer.java +85 -47
- package/ios/CometChatClipboardModule.m +11 -0
- package/ios/CometChatClipboardModule.swift +41 -0
- package/ios/FileManager.m +201 -39
- package/ios/RichTextEditorView.swift +367 -8
- package/ios/RichTextEditorViewManager.m +1 -0
- package/ios/SoundPlayer.m +18 -6
- package/package.json +10 -7
- package/react-native-cometchat-ui-kit.podspec +1 -0
- package/src/CometChatCompactMessageComposer/CometChatCompactMessageComposer.tsx +692 -107
- package/src/CometChatConversations/CometChatConversations.tsx +19 -6
- package/src/CometChatMessageComposer/CometChatMessageComposer.tsx +649 -49
- package/src/CometChatMessageHeader/CometChatMessageHeader.tsx +23 -4
- package/src/CometChatMessageList/CometChatMessageList.tsx +463 -54
- package/src/CometChatMessageList/SEARCH_NAV_SLOWNESS_FINDINGS_AND_FIX.md +313 -0
- package/src/CometChatMessageList/components/MessageListItem.tsx +30 -17
- package/src/CometChatMessageList/style.ts +33 -5
- package/src/CometChatRichTextEditor/RichTextEditorViewNativeComponent.ts +13 -0
- package/src/CometChatRichTextEditor/index.tsx +25 -0
- package/src/CometChatSearch/CometChatSearch.tsx +296 -154
- package/src/calls/CallingExtension.tsx +19 -13
- package/src/extensions/LinkPreview/LinkPreviewBubble.tsx +20 -1
- package/src/extensions/ThumbnailGeneration/ThumbnailGenerationDecorator.tsx +20 -9
- package/src/index.ts +39 -0
- package/src/shared/CometChatUiKit/CometChatUIKit.ts +40 -34
- package/src/shared/base/Types.ts +3 -0
- package/src/shared/constants/UIKitConstants.ts +15 -1
- package/src/shared/formatters/CometChatRichTextFormatter/index.tsx +3 -2
- package/src/shared/framework/DataSource.ts +14 -4
- package/src/shared/framework/DataSourceDecorator.tsx +17 -8
- package/src/shared/framework/MessageDataSource.tsx +307 -60
- package/src/shared/helper/useToast.tsx +29 -0
- package/src/shared/icons/components/audio-file-type.tsx +11 -22
- package/src/shared/icons/components/document-file-type.tsx +11 -24
- package/src/shared/icons/components/image-file-type.tsx +12 -21
- package/src/shared/icons/components/link-file-type.tsx +25 -0
- package/src/shared/icons/components/pdf-file-type.tsx +11 -22
- package/src/shared/icons/components/presentation-file-type.tsx +11 -24
- package/src/shared/icons/components/spreadsheet-file-type.tsx +11 -24
- package/src/shared/icons/components/text-file-type.tsx +11 -21
- package/src/shared/icons/components/unknown-file-type.tsx +21 -25
- package/src/shared/icons/components/video-file-type.tsx +11 -24
- package/src/shared/icons/components/zip-file-type.tsx +11 -24
- package/src/shared/icons/icon-mapping.tsx +2 -0
- package/src/shared/index.ts +28 -0
- package/src/shared/modals/AttachmentPickerConfiguration.ts +13 -0
- package/src/shared/modals/SelectedAttachment.ts +65 -0
- package/src/shared/modals/UploadState.ts +10 -0
- package/src/shared/modals/index.ts +4 -0
- package/src/shared/resources/CometChatLocalizeNew/resources/de/translation.json +42 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/en/translation.json +42 -1
- package/src/shared/resources/CometChatLocalizeNew/resources/es/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/fr/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/hi/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/hu/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/it/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/ja/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/ko/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/lt/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/ms/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/nl/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/pt/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/ru/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/sv/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/tr/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/zh/translation.json +43 -2
- package/src/shared/resources/CometChatLocalizeNew/resources/zh-tw/translation.json +43 -2
- package/src/shared/services/UploadQueueService.ts +145 -0
- package/src/shared/services/index.ts +2 -0
- package/src/shared/utils/CometChatMessagePreview/CometChatMessagePreview.tsx +44 -19
- package/src/shared/utils/MessageUtils.tsx +13 -4
- package/src/shared/utils/attachmentLimits.ts +156 -0
- package/src/shared/utils/audioPlaybackCoordinator.ts +28 -0
- package/src/shared/utils/batchMediaContext.tsx +30 -0
- package/src/shared/utils/conversationUtils.ts +26 -4
- package/src/shared/utils/elementType.tsx +38 -0
- package/src/shared/utils/groupAttachments.ts +93 -0
- package/src/shared/utils/index.ts +8 -0
- package/src/shared/utils/openMultiFileChooser.ts +123 -0
- package/src/shared/utils/partitionAttachmentsByKind.ts +44 -0
- package/src/shared/views/ClipboardPasteHandler/ClipboardPasteHandler.ts +28 -0
- package/src/shared/views/ClipboardPasteHandler/NativeCometChatClipboardModule.ts +16 -0
- package/src/shared/views/ClipboardPasteHandler/index.ts +2 -0
- package/src/shared/views/CometChatActionSheet/CometChatActionSheet.tsx +1 -0
- package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreview.style.ts +32 -0
- package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreview.tsx +90 -0
- package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentPreviewItem.tsx +276 -0
- package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTile.tsx +827 -0
- package/src/shared/views/CometChatAttachmentPreview/CometChatAttachmentTray.tsx +110 -0
- package/src/shared/views/CometChatAttachmentPreview/StagedVideoDurationProbe.tsx +53 -0
- package/src/shared/views/CometChatAttachmentPreview/index.ts +8 -0
- package/src/shared/views/CometChatAttachmentViewer/CometChatAttachmentViewer.tsx +305 -0
- package/src/shared/views/CometChatAttachmentViewer/index.ts +2 -0
- package/src/shared/views/CometChatAudioBubble/CometChatAudioBubble.tsx +71 -74
- package/src/shared/views/CometChatAudiosBubble/CometChatAudiosBubble.tsx +587 -0
- package/src/shared/views/CometChatAudiosBubble/index.ts +2 -0
- package/src/shared/views/CometChatBottomSheet/CometChatBottomSheet.tsx +31 -20
- package/src/shared/views/CometChatCaptionText/CometChatCaptionText.tsx +182 -0
- package/src/shared/views/CometChatCaptionText/index.ts +2 -0
- package/src/shared/views/CometChatComposerErrorBanner.tsx +83 -0
- package/src/shared/views/CometChatConversationStarter/CometChatConversationStarter.tsx +141 -0
- package/src/shared/views/CometChatConversationStarter/index.ts +2 -0
- package/src/shared/views/CometChatConversationSummary/CometChatConversationSummary.tsx +155 -0
- package/src/shared/views/CometChatConversationSummary/index.ts +2 -0
- package/src/shared/views/CometChatFileBubble/style.ts +6 -4
- package/src/shared/views/CometChatFilesBubble/CometChatFilesBubble.tsx +316 -0
- package/src/shared/views/CometChatFilesBubble/index.ts +2 -0
- package/src/shared/views/CometChatImagesBubble/CometChatImagesBubble.tsx +323 -0
- package/src/shared/views/CometChatImagesBubble/index.ts +2 -0
- package/src/shared/views/CometChatMediaViewer/CometChatMediaViewer.tsx +425 -0
- package/src/shared/views/CometChatMediaViewer/index.ts +2 -0
- package/src/shared/views/CometChatMediaViewer/mediaViewerUtils.ts +30 -0
- package/src/shared/views/CometChatMessageBubble/CometChatMessageBubble.tsx +14 -4
- package/src/shared/views/CometChatSendButtonView/CometChatSendButtonView.tsx +1 -0
- package/src/shared/views/CometChatSmartReplies/CometChatSmartReplies.tsx +172 -0
- package/src/shared/views/CometChatSmartReplies/index.ts +2 -0
- package/src/shared/views/CometChatTextBubble/CometChatTextBubble.tsx +4 -3
- package/src/shared/views/CometChatVideoBubble/style.ts +3 -3
- package/src/shared/views/CometChatVideosBubble/CometChatVideosBubble.tsx +441 -0
- package/src/shared/views/CometChatVideosBubble/index.ts +2 -0
- package/src/shared/views/CometChatVoiceNoteBubble/CometChatVoiceNoteBubble.tsx +78 -0
- package/src/shared/views/CometChatVoiceNoteBubble/index.ts +2 -0
- package/src/shared/views/index.ts +37 -1
- package/src/theme/CometChatThemeHelper.ts +8 -0
- package/src/theme/default/color/dark.ts +9 -0
- package/src/theme/default/color/light.ts +10 -0
- package/src/theme/type.ts +73 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FlatList, View } from 'react-native';
|
|
3
|
+
import { SelectedAttachment } from '../../modals/SelectedAttachment';
|
|
4
|
+
import { CometChatAttachmentPreviewItem } from './CometChatAttachmentPreviewItem';
|
|
5
|
+
import { useTheme } from '../../../theme';
|
|
6
|
+
import { useCompTheme } from '../../../theme/hook';
|
|
7
|
+
import { CometChatTheme } from '../../../theme/type';
|
|
8
|
+
import { deepMerge } from '../../helper/helperFunctions';
|
|
9
|
+
|
|
10
|
+
export interface CometChatAttachmentPreviewProps {
|
|
11
|
+
attachments: SelectedAttachment[];
|
|
12
|
+
onRemove: (fileId: string) => void;
|
|
13
|
+
onRetry: (fileId: string) => void;
|
|
14
|
+
/** Custom styles for the attachment preview, overriding theme styles. */
|
|
15
|
+
style?: CometChatTheme["attachmentPreviewStyles"];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function useAggregatePercent(attachments: SelectedAttachment[]): number {
|
|
19
|
+
const totalBytes = attachments.reduce((s, a) => s + (a.file.size || 0), 0);
|
|
20
|
+
if (totalBytes === 0) return 0;
|
|
21
|
+
const loadedBytes = attachments.reduce(
|
|
22
|
+
(s, a) => s + ((a.uploadProgress / 100) * (a.file.size || 0)),
|
|
23
|
+
0
|
|
24
|
+
);
|
|
25
|
+
return Math.min(100, Math.round((loadedBytes / totalBytes) * 100));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const CometChatAttachmentPreview = ({
|
|
29
|
+
attachments,
|
|
30
|
+
onRemove,
|
|
31
|
+
onRetry,
|
|
32
|
+
style,
|
|
33
|
+
}: CometChatAttachmentPreviewProps) => {
|
|
34
|
+
const theme = useTheme();
|
|
35
|
+
const compTheme = useCompTheme();
|
|
36
|
+
const s = deepMerge(
|
|
37
|
+
theme.attachmentPreviewStyles ?? {},
|
|
38
|
+
compTheme.attachmentPreviewStyles ?? {},
|
|
39
|
+
style ?? {}
|
|
40
|
+
);
|
|
41
|
+
const aggregatePercent = useAggregatePercent(attachments);
|
|
42
|
+
const allDone = attachments.every(
|
|
43
|
+
a => a.uploadState === 'COMPLETED' || a.uploadState === 'FAILED' || a.uploadState === 'REJECTED'
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
if (attachments.length === 0) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<View style={s.containerStyle}>
|
|
52
|
+
<FlatList
|
|
53
|
+
horizontal
|
|
54
|
+
data={attachments}
|
|
55
|
+
keyExtractor={(item) => item.fileId}
|
|
56
|
+
renderItem={({ item }) => (
|
|
57
|
+
<CometChatAttachmentPreviewItem
|
|
58
|
+
attachment={item}
|
|
59
|
+
onRemove={onRemove}
|
|
60
|
+
onRetry={onRetry}
|
|
61
|
+
/>
|
|
62
|
+
)}
|
|
63
|
+
showsHorizontalScrollIndicator={false}
|
|
64
|
+
contentContainerStyle={{ paddingHorizontal: theme.spacing.spacing.s2 }}
|
|
65
|
+
/>
|
|
66
|
+
{/* §5.4 — byte-weighted aggregate bar; hidden once all files resolve */}
|
|
67
|
+
{!allDone && (
|
|
68
|
+
<View
|
|
69
|
+
style={{
|
|
70
|
+
height: theme.spacing.spacing.s0_5,
|
|
71
|
+
marginHorizontal: theme.spacing.spacing.s2,
|
|
72
|
+
marginBottom: theme.spacing.spacing.s1,
|
|
73
|
+
borderRadius: theme.spacing.spacing.s0_5,
|
|
74
|
+
backgroundColor: theme.color.neutral200,
|
|
75
|
+
overflow: 'hidden',
|
|
76
|
+
}}
|
|
77
|
+
>
|
|
78
|
+
<View
|
|
79
|
+
style={{
|
|
80
|
+
height: theme.spacing.spacing.s0_5,
|
|
81
|
+
width: `${aggregatePercent}%`,
|
|
82
|
+
backgroundColor: theme.color.primary,
|
|
83
|
+
borderRadius: theme.spacing.spacing.s0_5,
|
|
84
|
+
}}
|
|
85
|
+
/>
|
|
86
|
+
</View>
|
|
87
|
+
)}
|
|
88
|
+
</View>
|
|
89
|
+
);
|
|
90
|
+
};
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import React, { useEffect, useRef } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
ActivityIndicator,
|
|
4
|
+
Animated,
|
|
5
|
+
Image,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
Text,
|
|
8
|
+
TouchableOpacity,
|
|
9
|
+
View,
|
|
10
|
+
} from 'react-native';
|
|
11
|
+
import { useTheme } from '../../../theme';
|
|
12
|
+
import { useCompTheme } from '../../../theme/hook';
|
|
13
|
+
import { CometChatTheme } from '../../../theme/type';
|
|
14
|
+
import { SelectedAttachment } from '../../modals/SelectedAttachment';
|
|
15
|
+
import { deepMerge } from '../../helper/helperFunctions';
|
|
16
|
+
|
|
17
|
+
export interface CometChatAttachmentPreviewItemProps {
|
|
18
|
+
attachment: SelectedAttachment;
|
|
19
|
+
onRemove: (fileId: string) => void;
|
|
20
|
+
onRetry: (fileId: string) => void;
|
|
21
|
+
/** Custom styles for the attachment preview item, overriding theme styles. */
|
|
22
|
+
style?: CometChatTheme["attachmentPreviewItemStyles"];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Intentional media scrims/overlays painted over attachment thumbnails (not UI-surface colors) —
|
|
26
|
+
// no theme-token equivalent, so kept as documented consts per the project's OVERLAY_COLOR convention.
|
|
27
|
+
const OVERLAY_COLOR = 'rgba(0,0,0,0.45)';
|
|
28
|
+
const PLAY_GLYPH_DIM = 'rgba(255,255,255,0.8)'; // dimmed white ▶ over a loading thumbnail
|
|
29
|
+
const REJECTED_SCRIM_COLOR = 'rgba(180,0,0,0.55)'; // red scrim over a REJECTED tile
|
|
30
|
+
const REMOVE_BADGE_BG = 'rgba(0,0,0,0.55)'; // ✕ remove-badge backing
|
|
31
|
+
|
|
32
|
+
export const CometChatAttachmentPreviewItem = ({
|
|
33
|
+
attachment,
|
|
34
|
+
onRemove,
|
|
35
|
+
onRetry,
|
|
36
|
+
style,
|
|
37
|
+
}: CometChatAttachmentPreviewItemProps) => {
|
|
38
|
+
const theme = useTheme();
|
|
39
|
+
const compTheme = useCompTheme();
|
|
40
|
+
const s = deepMerge(
|
|
41
|
+
theme.attachmentPreviewItemStyles ?? {},
|
|
42
|
+
compTheme.attachmentPreviewItemStyles ?? {},
|
|
43
|
+
style ?? {}
|
|
44
|
+
);
|
|
45
|
+
const ITEM_SIZE = theme.spacing.spacing.s18;
|
|
46
|
+
const BORDER_RADIUS = theme.spacing.radius.r2;
|
|
47
|
+
const { fileId, file, uploadState, uploadProgress } = attachment;
|
|
48
|
+
|
|
49
|
+
const checkmarkOpacity = useRef(new Animated.Value(0)).current;
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (uploadState === 'COMPLETED') {
|
|
53
|
+
checkmarkOpacity.setValue(1);
|
|
54
|
+
Animated.delay(1000).start(() => {
|
|
55
|
+
Animated.timing(checkmarkOpacity, {
|
|
56
|
+
toValue: 0,
|
|
57
|
+
duration: 400,
|
|
58
|
+
useNativeDriver: true,
|
|
59
|
+
}).start();
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}, [uploadState]);
|
|
63
|
+
|
|
64
|
+
const isMedia =
|
|
65
|
+
file.type.startsWith('image/') || file.type.startsWith('video/');
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<View
|
|
69
|
+
style={[{
|
|
70
|
+
width: ITEM_SIZE,
|
|
71
|
+
height: ITEM_SIZE,
|
|
72
|
+
borderRadius: BORDER_RADIUS,
|
|
73
|
+
margin: theme.spacing.spacing.s1,
|
|
74
|
+
overflow: 'hidden',
|
|
75
|
+
backgroundColor: theme.color.neutral200,
|
|
76
|
+
}, s.containerStyle]}
|
|
77
|
+
>
|
|
78
|
+
{/* Thumbnail */}
|
|
79
|
+
{isMedia ? (
|
|
80
|
+
<Image
|
|
81
|
+
source={{ uri: file.uri }}
|
|
82
|
+
style={{ width: ITEM_SIZE, height: ITEM_SIZE }}
|
|
83
|
+
resizeMode="cover"
|
|
84
|
+
/>
|
|
85
|
+
) : (
|
|
86
|
+
<View
|
|
87
|
+
style={{
|
|
88
|
+
flex: 1,
|
|
89
|
+
justifyContent: 'center',
|
|
90
|
+
alignItems: 'center',
|
|
91
|
+
paddingHorizontal: theme.spacing.spacing.s1,
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
<Text
|
|
95
|
+
numberOfLines={2}
|
|
96
|
+
style={{
|
|
97
|
+
...theme.typography.caption2.regular,
|
|
98
|
+
color: theme.color.neutral700,
|
|
99
|
+
textAlign: 'center',
|
|
100
|
+
}}
|
|
101
|
+
>
|
|
102
|
+
{file.name}
|
|
103
|
+
</Text>
|
|
104
|
+
</View>
|
|
105
|
+
)}
|
|
106
|
+
|
|
107
|
+
{/* Video play icon */}
|
|
108
|
+
{file.type.startsWith('video/') && (
|
|
109
|
+
<View
|
|
110
|
+
pointerEvents="none"
|
|
111
|
+
style={styles.fillCenter}
|
|
112
|
+
>
|
|
113
|
+
<Text style={{ fontSize: theme.typography.heading2.regular.fontSize, color: PLAY_GLYPH_DIM }}>
|
|
114
|
+
{'▶'}
|
|
115
|
+
</Text>
|
|
116
|
+
</View>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
{/* NONE state — indeterminate spinner */}
|
|
120
|
+
{uploadState === 'NONE' && (
|
|
121
|
+
<View
|
|
122
|
+
pointerEvents="none"
|
|
123
|
+
style={{
|
|
124
|
+
position: 'absolute',
|
|
125
|
+
top: 0,
|
|
126
|
+
left: 0,
|
|
127
|
+
right: 0,
|
|
128
|
+
bottom: 0,
|
|
129
|
+
backgroundColor: OVERLAY_COLOR,
|
|
130
|
+
justifyContent: 'center',
|
|
131
|
+
alignItems: 'center',
|
|
132
|
+
}}
|
|
133
|
+
>
|
|
134
|
+
<ActivityIndicator color={theme.color.staticWhite} size="small" />
|
|
135
|
+
</View>
|
|
136
|
+
)}
|
|
137
|
+
|
|
138
|
+
{/* UPLOADING state — progress arc + percentage */}
|
|
139
|
+
{uploadState === 'UPLOADING' && (
|
|
140
|
+
<View
|
|
141
|
+
pointerEvents="none"
|
|
142
|
+
style={{
|
|
143
|
+
position: 'absolute',
|
|
144
|
+
top: 0,
|
|
145
|
+
left: 0,
|
|
146
|
+
right: 0,
|
|
147
|
+
bottom: 0,
|
|
148
|
+
backgroundColor: OVERLAY_COLOR,
|
|
149
|
+
justifyContent: 'center',
|
|
150
|
+
alignItems: 'center',
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
<Text
|
|
154
|
+
style={{
|
|
155
|
+
...theme.typography.caption2.medium,
|
|
156
|
+
color: theme.color.staticWhite,
|
|
157
|
+
}}
|
|
158
|
+
>
|
|
159
|
+
{`${Math.round(uploadProgress)}%`}
|
|
160
|
+
</Text>
|
|
161
|
+
</View>
|
|
162
|
+
)}
|
|
163
|
+
|
|
164
|
+
{/* COMPLETED state — fading checkmark */}
|
|
165
|
+
<Animated.View
|
|
166
|
+
pointerEvents="none"
|
|
167
|
+
style={{
|
|
168
|
+
position: 'absolute',
|
|
169
|
+
top: 0,
|
|
170
|
+
left: 0,
|
|
171
|
+
right: 0,
|
|
172
|
+
bottom: 0,
|
|
173
|
+
backgroundColor: OVERLAY_COLOR,
|
|
174
|
+
justifyContent: 'center',
|
|
175
|
+
alignItems: 'center',
|
|
176
|
+
opacity: checkmarkOpacity,
|
|
177
|
+
}}
|
|
178
|
+
>
|
|
179
|
+
<Text style={{ fontSize: theme.typography.heading2.regular.fontSize, color: theme.color.staticWhite }}>
|
|
180
|
+
{'✓'}
|
|
181
|
+
</Text>
|
|
182
|
+
</Animated.View>
|
|
183
|
+
|
|
184
|
+
{/* FAILED state — warning icon, tap to retry */}
|
|
185
|
+
{uploadState === 'FAILED' && (
|
|
186
|
+
<TouchableOpacity
|
|
187
|
+
onPress={() => onRetry(fileId)}
|
|
188
|
+
activeOpacity={0.8}
|
|
189
|
+
style={{
|
|
190
|
+
position: 'absolute',
|
|
191
|
+
top: 0,
|
|
192
|
+
left: 0,
|
|
193
|
+
right: 0,
|
|
194
|
+
bottom: 0,
|
|
195
|
+
backgroundColor: OVERLAY_COLOR,
|
|
196
|
+
justifyContent: 'center',
|
|
197
|
+
alignItems: 'center',
|
|
198
|
+
}}
|
|
199
|
+
accessibilityRole="button"
|
|
200
|
+
accessibilityLabel="Retry upload"
|
|
201
|
+
>
|
|
202
|
+
<Text style={{ fontSize: theme.typography.heading2.regular.fontSize, color: theme.color.error }}>
|
|
203
|
+
{'⚠'}
|
|
204
|
+
</Text>
|
|
205
|
+
</TouchableOpacity>
|
|
206
|
+
)}
|
|
207
|
+
|
|
208
|
+
{/* REJECTED state — permanent failure, no retry (remove via × button) */}
|
|
209
|
+
{uploadState === 'REJECTED' && (
|
|
210
|
+
<View
|
|
211
|
+
pointerEvents="none"
|
|
212
|
+
style={{
|
|
213
|
+
position: 'absolute',
|
|
214
|
+
top: 0,
|
|
215
|
+
left: 0,
|
|
216
|
+
right: 0,
|
|
217
|
+
bottom: 0,
|
|
218
|
+
backgroundColor: REJECTED_SCRIM_COLOR,
|
|
219
|
+
justifyContent: 'center',
|
|
220
|
+
alignItems: 'center',
|
|
221
|
+
}}
|
|
222
|
+
>
|
|
223
|
+
<Text style={{ fontSize: theme.typography.heading2.regular.fontSize, color: theme.color.staticWhite }}>
|
|
224
|
+
{'⛔'}
|
|
225
|
+
</Text>
|
|
226
|
+
</View>
|
|
227
|
+
)}
|
|
228
|
+
|
|
229
|
+
{/* Remove (×) button — always visible */}
|
|
230
|
+
<TouchableOpacity
|
|
231
|
+
onPress={() => onRemove(fileId)}
|
|
232
|
+
hitSlop={{
|
|
233
|
+
top: theme.spacing.spacing.s2,
|
|
234
|
+
right: theme.spacing.spacing.s2,
|
|
235
|
+
bottom: theme.spacing.spacing.s2,
|
|
236
|
+
left: theme.spacing.spacing.s2,
|
|
237
|
+
}}
|
|
238
|
+
style={[{
|
|
239
|
+
position: 'absolute',
|
|
240
|
+
top: theme.spacing.spacing.s1,
|
|
241
|
+
right: theme.spacing.spacing.s1,
|
|
242
|
+
width: theme.spacing.spacing.s4,
|
|
243
|
+
height: theme.spacing.spacing.s4,
|
|
244
|
+
borderRadius: theme.spacing.radius.r2,
|
|
245
|
+
backgroundColor: REMOVE_BADGE_BG,
|
|
246
|
+
justifyContent: 'center',
|
|
247
|
+
alignItems: 'center',
|
|
248
|
+
}, s.removeButtonStyle]}
|
|
249
|
+
accessibilityRole="button"
|
|
250
|
+
accessibilityLabel="Remove attachment"
|
|
251
|
+
>
|
|
252
|
+
<Text
|
|
253
|
+
style={{
|
|
254
|
+
color: theme.color.staticWhite,
|
|
255
|
+
fontSize: theme.typography.caption2.regular.fontSize,
|
|
256
|
+
lineHeight: 12,
|
|
257
|
+
}}
|
|
258
|
+
>
|
|
259
|
+
{'✕'}
|
|
260
|
+
</Text>
|
|
261
|
+
</TouchableOpacity>
|
|
262
|
+
</View>
|
|
263
|
+
);
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const styles = StyleSheet.create({
|
|
267
|
+
fillCenter: {
|
|
268
|
+
position: 'absolute',
|
|
269
|
+
top: 0,
|
|
270
|
+
left: 0,
|
|
271
|
+
right: 0,
|
|
272
|
+
bottom: 0,
|
|
273
|
+
justifyContent: 'center',
|
|
274
|
+
alignItems: 'center',
|
|
275
|
+
},
|
|
276
|
+
});
|