@cometchat/chat-uikit-react-native 5.3.10 → 5.4.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/.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
- 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 +237 -6
- 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 +312 -4
- package/ios/RichTextEditorViewManager.m +1 -0
- package/ios/SoundPlayer.m +18 -6
- package/package.json +9 -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/MANUAL_TEST_CASES.md +154 -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/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 +42 -18
- 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/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 +5 -7
- 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/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
- package/src/CometChatMessageList/PERFORMANCE_ARCHITECTURE.md +0 -478
- package/src/CometChatMessageList/SEARCH_NAV_PERF_PLAN.md +0 -613
- package/src/shared/CometChatUiKit/CometChatUIKit.changes.md +0 -76
- package/src/shared/CometChatUiKit/checkAuthSettings-review.md +0 -211
|
@@ -0,0 +1,587 @@
|
|
|
1
|
+
import React, { useEffect, useMemo, useRef, useState } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
GestureResponderEvent,
|
|
4
|
+
ImageStyle,
|
|
5
|
+
LayoutChangeEvent,
|
|
6
|
+
NativeEventEmitter,
|
|
7
|
+
NativeModules,
|
|
8
|
+
PanResponder,
|
|
9
|
+
Platform,
|
|
10
|
+
StyleProp,
|
|
11
|
+
Text,
|
|
12
|
+
TextStyle,
|
|
13
|
+
TouchableOpacity,
|
|
14
|
+
View,
|
|
15
|
+
ViewStyle,
|
|
16
|
+
} from 'react-native';
|
|
17
|
+
import { CometChat } from '@cometchat/chat-sdk-react-native';
|
|
18
|
+
import { CometChatTheme } from '../../../theme/type';
|
|
19
|
+
import { Icon } from '../../icons/Icon';
|
|
20
|
+
import { CometChatUIKit } from '../../CometChatUiKit';
|
|
21
|
+
import { audioPlaybackCoordinator } from '../../utils/audioPlaybackCoordinator';
|
|
22
|
+
import { deepMerge } from '../../helper/helperFunctions';
|
|
23
|
+
import { useCompTheme } from '../../../theme/hook';
|
|
24
|
+
import { CometChatCaptionText } from '../CometChatCaptionText';
|
|
25
|
+
import { useCometChatTranslation } from '../../resources/CometChatLocalizeNew';
|
|
26
|
+
import { ATTACHMENT_COLLAPSED_LIMIT } from '../../constants/UIKitConstants';
|
|
27
|
+
|
|
28
|
+
const { SoundPlayer, FileManager } = NativeModules;
|
|
29
|
+
const soundEvents = new NativeEventEmitter(SoundPlayer);
|
|
30
|
+
|
|
31
|
+
// ---------------------------------------------------------------------------
|
|
32
|
+
// Design doc §8.1a — the "AudiosBubble": a player for a SHARED / picked audio file
|
|
33
|
+
// (no metadata.audioType). Renders a circular play/pause control, the file name, a
|
|
34
|
+
// draggable seek bar, elapsed/total time (00:00/00:32), and a download button (single,
|
|
35
|
+
// or a stack for several). RECORDED voice notes (metadata.audioType === "voice_note")
|
|
36
|
+
// use the waveform bubble instead (CometChatVoiceNoteBubble, built on the existing
|
|
37
|
+
// CometChatAudioBubble). Playback + seek use the native SoundPlayer module; download
|
|
38
|
+
// reuses FileManager.checkAndDownload like the file/media bubbles.
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
|
|
41
|
+
function fmt(secs: number): string {
|
|
42
|
+
const s = Math.max(0, Math.floor(secs || 0));
|
|
43
|
+
return `${String(Math.floor(s / 60)).padStart(2, '0')}:${String(s % 60).padStart(2, '0')}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// §8.1a — audio formats the native SoundPlayer can render. Anything else (opus, wma, amr, aiff, …) or
|
|
47
|
+
// an unknown extension can't be previewed/played, so it falls back to a plain file card instead of a
|
|
48
|
+
// broken/empty player. The native module gives no load-error signal, so we gate by extension.
|
|
49
|
+
const PLAYABLE_AUDIO_EXT = new Set(['mp3', 'wav', 'ogg', 'aac', 'm4a', 'flac']);
|
|
50
|
+
const isPlayableAudio = (att: CometChat.Attachment): boolean =>
|
|
51
|
+
PLAYABLE_AUDIO_EXT.has((att.getName?.() ?? '').split('.').pop()?.toLowerCase() ?? '');
|
|
52
|
+
|
|
53
|
+
interface AudioFilePlayerProps {
|
|
54
|
+
attachment: CometChat.Attachment;
|
|
55
|
+
isSentByMe: boolean;
|
|
56
|
+
theme: CometChatTheme;
|
|
57
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
58
|
+
playButtonStyle?: StyleProp<ViewStyle>;
|
|
59
|
+
playIconStyle?: ImageStyle;
|
|
60
|
+
fileNameStyle?: TextStyle;
|
|
61
|
+
seekTrackStyle?: StyleProp<ViewStyle>;
|
|
62
|
+
seekProgressStyle?: StyleProp<ViewStyle>;
|
|
63
|
+
seekThumbStyle?: StyleProp<ViewStyle>;
|
|
64
|
+
timeTextStyle?: TextStyle;
|
|
65
|
+
downloadIconStyle?: ImageStyle;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const AudioFilePlayer = ({
|
|
69
|
+
attachment,
|
|
70
|
+
isSentByMe,
|
|
71
|
+
theme,
|
|
72
|
+
containerStyle,
|
|
73
|
+
playButtonStyle,
|
|
74
|
+
playIconStyle,
|
|
75
|
+
fileNameStyle,
|
|
76
|
+
seekTrackStyle,
|
|
77
|
+
seekProgressStyle,
|
|
78
|
+
seekThumbStyle,
|
|
79
|
+
timeTextStyle,
|
|
80
|
+
downloadIconStyle,
|
|
81
|
+
}: AudioFilePlayerProps) => {
|
|
82
|
+
const url = attachment.getUrl();
|
|
83
|
+
// Dimension tokens (theme spacing): CIRCLE 56 = s14, THUMB 12 = s3, TRACK_H = s2 (8) — a proper
|
|
84
|
+
// seek-bar thickness (s1/4 read as a thin hairline). No raw pixel literals — everything derives
|
|
85
|
+
// from the theme scale.
|
|
86
|
+
const S = theme.spacing.spacing;
|
|
87
|
+
const CIRCLE = S.s14;
|
|
88
|
+
const THUMB = S.s3;
|
|
89
|
+
const TRACK_H = S.s2;
|
|
90
|
+
const [status, setStatus] = useState<'playing' | 'paused' | 'loading' | ''>('');
|
|
91
|
+
const [duration, setDuration] = useState(0);
|
|
92
|
+
const [currentTime, setCurrentTime] = useState(0);
|
|
93
|
+
const [trackWidth, setTrackWidth] = useState(0);
|
|
94
|
+
const [dragRatio, setDragRatio] = useState<number | null>(null);
|
|
95
|
+
const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
|
96
|
+
// Refs so the coordinator/native listeners (bound once) read live values without stale closures.
|
|
97
|
+
const statusRef = useRef(status); statusRef.current = status;
|
|
98
|
+
const currentTimeRef = useRef(currentTime); currentTimeRef.current = currentTime;
|
|
99
|
+
// True when THIS clip was paused because another audio started — the native player has since
|
|
100
|
+
// moved to that other clip, so resuming means re-playing this url from `currentTime`.
|
|
101
|
+
const wasInterruptedRef = useRef(false);
|
|
102
|
+
|
|
103
|
+
// Prefer a duration already carried in metadata; else ask the native player.
|
|
104
|
+
const metaDuration = useMemo(() => {
|
|
105
|
+
try {
|
|
106
|
+
const meta = attachment.getMetadata?.() as Record<string, unknown> | undefined;
|
|
107
|
+
const raw = meta?.duration ?? meta?.audio_duration;
|
|
108
|
+
return typeof raw === 'number' && raw > 0 ? raw : 0;
|
|
109
|
+
} catch {
|
|
110
|
+
return 0;
|
|
111
|
+
}
|
|
112
|
+
}, [attachment]);
|
|
113
|
+
|
|
114
|
+
useEffect(() => {
|
|
115
|
+
if (metaDuration) {
|
|
116
|
+
// Duration is already known from metadata — do NOT create the shared native player on mount.
|
|
117
|
+
// Prepping every card's clip (and releasing it on unmount) thrashes the single shared Android
|
|
118
|
+
// MediaPlayer, which left cards unplayable after re-entering the conversation. Create it lazily
|
|
119
|
+
// on play() instead — matching how iOS already behaves.
|
|
120
|
+
setDuration(metaDuration);
|
|
121
|
+
} else if (url) {
|
|
122
|
+
// No metadata duration → read it once via the shared player (rare now that the composer writes it).
|
|
123
|
+
SoundPlayer.prepareMediaPlayer(url, (s: string) => {
|
|
124
|
+
try {
|
|
125
|
+
const d = JSON.parse(s)?.duration;
|
|
126
|
+
if (typeof d === 'number' && d > 0) setDuration(d);
|
|
127
|
+
} catch {}
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
return () => {
|
|
131
|
+
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
132
|
+
// Only release the SHARED player if THIS card was the one using it. Releasing on every card's
|
|
133
|
+
// unmount is what thrashed the single Android player; this still stops OUR audio on unmount.
|
|
134
|
+
if (statusRef.current === 'playing' || statusRef.current === 'paused') {
|
|
135
|
+
SoundPlayer.releaseMediaPlayer();
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
}, [url, metaDuration]);
|
|
139
|
+
|
|
140
|
+
// WhatsApp-style coordination: when ANOTHER audio (recorded or shared) starts, pause THIS clip
|
|
141
|
+
// in place — keep its position so it can resume from where it left off. The native player has
|
|
142
|
+
// moved to the other clip, so mark it interrupted; resuming re-plays this url from currentTime.
|
|
143
|
+
useEffect(() => {
|
|
144
|
+
const unsub = audioPlaybackCoordinator.subscribe((activeUrl) => {
|
|
145
|
+
if (activeUrl === url) return; // this bubble is the one that (re)started
|
|
146
|
+
if (statusRef.current === 'playing' || statusRef.current === 'paused') {
|
|
147
|
+
wasInterruptedRef.current = true;
|
|
148
|
+
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
149
|
+
setStatus('paused'); // keep currentTime — position preserved
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
return unsub;
|
|
153
|
+
}, [url]);
|
|
154
|
+
|
|
155
|
+
// Native fires soundPlayStatus on natural completion AND when a new play() replaces this clip.
|
|
156
|
+
// If we were interrupted it's the replace-echo → ignore (keep the in-place pause); otherwise
|
|
157
|
+
// it's a genuine finish → reset to idle.
|
|
158
|
+
useEffect(() => {
|
|
159
|
+
const sub = soundEvents.addListener('soundPlayStatus', (data: { url?: string }) => {
|
|
160
|
+
if (data?.url !== url) return;
|
|
161
|
+
if (wasInterruptedRef.current) return; // interrupt echo — keep the in-place pause
|
|
162
|
+
setStatus('');
|
|
163
|
+
setCurrentTime(0);
|
|
164
|
+
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
165
|
+
});
|
|
166
|
+
return () => sub.remove();
|
|
167
|
+
}, [url]);
|
|
168
|
+
|
|
169
|
+
const startPolling = () => {
|
|
170
|
+
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
171
|
+
intervalRef.current = setInterval(() => {
|
|
172
|
+
SoundPlayer.getPosition((info: string) => {
|
|
173
|
+
try {
|
|
174
|
+
const p = JSON.parse(info)?.position;
|
|
175
|
+
if (typeof p === 'number') setCurrentTime(p);
|
|
176
|
+
} catch {}
|
|
177
|
+
});
|
|
178
|
+
}, 250);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
// (Re)play this clip from `fromSeconds` (0 = start). Announces first so any other playing clip
|
|
182
|
+
// pauses in place, then plays + seeks. Native success is boolean (Android) / int 1 (iOS).
|
|
183
|
+
const play = (fromSeconds = 0) => {
|
|
184
|
+
audioPlaybackCoordinator.announcePlay(url);
|
|
185
|
+
wasInterruptedRef.current = false;
|
|
186
|
+
setStatus('loading');
|
|
187
|
+
SoundPlayer.play(url, (s: string) => {
|
|
188
|
+
try {
|
|
189
|
+
if (JSON.parse(s)?.success) {
|
|
190
|
+
setStatus('playing');
|
|
191
|
+
if (fromSeconds > 0) SoundPlayer.playAt(Math.floor(fromSeconds), () => {});
|
|
192
|
+
startPolling();
|
|
193
|
+
} else {
|
|
194
|
+
setStatus('');
|
|
195
|
+
}
|
|
196
|
+
} catch {
|
|
197
|
+
setStatus('');
|
|
198
|
+
}
|
|
199
|
+
});
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
const togglePlay = () => {
|
|
203
|
+
if (status === 'playing') {
|
|
204
|
+
// User pause — the native player is still ours, so a plain resume works later.
|
|
205
|
+
wasInterruptedRef.current = false;
|
|
206
|
+
SoundPlayer.pause((s: string) => {
|
|
207
|
+
try {
|
|
208
|
+
if (JSON.parse(s)?.success) {
|
|
209
|
+
setStatus('paused');
|
|
210
|
+
if (intervalRef.current) clearInterval(intervalRef.current);
|
|
211
|
+
}
|
|
212
|
+
} catch {}
|
|
213
|
+
});
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (status === 'paused') {
|
|
217
|
+
if (wasInterruptedRef.current) {
|
|
218
|
+
play(currentTimeRef.current); // player moved away — re-play from where we paused
|
|
219
|
+
} else {
|
|
220
|
+
audioPlaybackCoordinator.announcePlay(url); // resuming still stops any other clip
|
|
221
|
+
SoundPlayer.resume();
|
|
222
|
+
setStatus('playing');
|
|
223
|
+
startPolling();
|
|
224
|
+
}
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (url) play(currentTimeRef.current || 0);
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
// Seek to a fraction of the clip. If our clip is the current native player, seek directly;
|
|
231
|
+
// otherwise (paused / interrupted / idle) re-play from the sought position.
|
|
232
|
+
const seekToRatio = (ratio: number) => {
|
|
233
|
+
const clamped = Math.max(0, Math.min(1, ratio));
|
|
234
|
+
const seconds = Math.floor(clamped * (duration || 0));
|
|
235
|
+
setCurrentTime(seconds);
|
|
236
|
+
if (status === 'playing' && !wasInterruptedRef.current) {
|
|
237
|
+
SoundPlayer.playAt(seconds, () => {});
|
|
238
|
+
startPolling();
|
|
239
|
+
} else {
|
|
240
|
+
play(seconds);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
const ratioFromX = (x: number) => (trackWidth > 0 ? x / trackWidth : 0);
|
|
245
|
+
|
|
246
|
+
const panResponder = useMemo(
|
|
247
|
+
() =>
|
|
248
|
+
PanResponder.create({
|
|
249
|
+
onStartShouldSetPanResponder: () => true,
|
|
250
|
+
onMoveShouldSetPanResponder: () => true,
|
|
251
|
+
onPanResponderGrant: (e: GestureResponderEvent) => {
|
|
252
|
+
setDragRatio(ratioFromX(e.nativeEvent.locationX));
|
|
253
|
+
},
|
|
254
|
+
onPanResponderMove: (e: GestureResponderEvent) => {
|
|
255
|
+
setDragRatio(ratioFromX(e.nativeEvent.locationX));
|
|
256
|
+
},
|
|
257
|
+
onPanResponderRelease: (e: GestureResponderEvent) => {
|
|
258
|
+
const r = ratioFromX(e.nativeEvent.locationX);
|
|
259
|
+
setDragRatio(null);
|
|
260
|
+
seekToRatio(r);
|
|
261
|
+
},
|
|
262
|
+
onPanResponderTerminate: () => setDragRatio(null),
|
|
263
|
+
}),
|
|
264
|
+
[trackWidth, duration]
|
|
265
|
+
);
|
|
266
|
+
|
|
267
|
+
const progressRatio =
|
|
268
|
+
dragRatio != null
|
|
269
|
+
? dragRatio
|
|
270
|
+
: duration > 0
|
|
271
|
+
? Math.min(1, currentTime / duration)
|
|
272
|
+
: 0;
|
|
273
|
+
|
|
274
|
+
// Reuse the same native download path as the file/media bubbles.
|
|
275
|
+
const download = () => {
|
|
276
|
+
if (!url) return;
|
|
277
|
+
FileManager?.checkAndDownload?.(url, attachment.getName(), () => {});
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
// All colors are theme tokens (no hardcoded literals). Sent = purple bubble, received = neutral.
|
|
281
|
+
// Design §8.1a — SOLID white play circle with a primary glyph on the sent card; received inverts
|
|
282
|
+
// (primary circle + white glyph). Card/track fills use the extendedPrimary scale (a lighter purple
|
|
283
|
+
// in light, darker in dark — either way a distinct surface); text/icons use the send/receive
|
|
284
|
+
// bubble tokens, which stay legible in BOTH themes (extendedPrimary text would flip dark = illegible).
|
|
285
|
+
const circleBg = isSentByMe ? theme.color.staticWhite : theme.color.primary;
|
|
286
|
+
const playColor = isSentByMe ? theme.color.primary : theme.color.staticWhite;
|
|
287
|
+
// Sent bubble: soft translucent-white track (theme token), not the darker extendedPrimary500.
|
|
288
|
+
const trackBg = isSentByMe ? theme.color.sendBubbleTrack : theme.color.neutral500;
|
|
289
|
+
const fillColor = isSentByMe ? theme.color.staticWhite : theme.color.primary;
|
|
290
|
+
const nameColor = isSentByMe ? theme.color.sendBubbleText : theme.color.receiveBubbleText;
|
|
291
|
+
const timeColor = isSentByMe ? theme.color.sendBubbleTimestamp : theme.color.receiveBubbleTimestamp;
|
|
292
|
+
const downloadColor = isSentByMe ? theme.color.sendBubbleIcon : theme.color.receiveBubbleIcon;
|
|
293
|
+
|
|
294
|
+
// Elapsed time to show alongside the total (00:00/00:32), tracking the drag while seeking.
|
|
295
|
+
// Clamp to the duration so a mis-read clip can't show a time past the total (e.g. 00:03/00:01).
|
|
296
|
+
const rawCur = dragRatio != null ? dragRatio * duration : currentTime;
|
|
297
|
+
const displayCur = duration > 0 ? Math.min(rawCur, duration) : rawCur;
|
|
298
|
+
|
|
299
|
+
const onTrackLayout = (e: LayoutChangeEvent) => setTrackWidth(e.nativeEvent.layout.width);
|
|
300
|
+
|
|
301
|
+
return (
|
|
302
|
+
// No own frame — inherits the shared audio-bubble container from the message-bubble wrapper.
|
|
303
|
+
<View testID="bubble-audio" style={[{ flexDirection: 'row', alignItems: 'center', gap: S.s3 }, containerStyle]}>
|
|
304
|
+
{/* Play/pause circle */}
|
|
305
|
+
<TouchableOpacity
|
|
306
|
+
onPress={togglePlay}
|
|
307
|
+
accessibilityRole="button"
|
|
308
|
+
accessibilityLabel={status === 'playing' ? 'Pause audio' : 'Play audio'}
|
|
309
|
+
style={[{
|
|
310
|
+
width: CIRCLE,
|
|
311
|
+
height: CIRCLE,
|
|
312
|
+
borderRadius: CIRCLE / 2,
|
|
313
|
+
backgroundColor: circleBg,
|
|
314
|
+
alignItems: 'center',
|
|
315
|
+
justifyContent: 'center',
|
|
316
|
+
}, playButtonStyle]}
|
|
317
|
+
>
|
|
318
|
+
<Icon
|
|
319
|
+
name={status === 'playing' ? 'pause-fill' : 'play-arrow-fill'}
|
|
320
|
+
size={S.s6}
|
|
321
|
+
color={playColor as string}
|
|
322
|
+
imageStyle={playIconStyle}
|
|
323
|
+
/>
|
|
324
|
+
</TouchableOpacity>
|
|
325
|
+
|
|
326
|
+
{/* Filename · (seek bar + download) · elapsed/total */}
|
|
327
|
+
<View style={{ flex: 1 }}>
|
|
328
|
+
<Text
|
|
329
|
+
numberOfLines={1}
|
|
330
|
+
ellipsizeMode="middle"
|
|
331
|
+
style={[{ ...theme.typography.body.medium, color: nameColor }, fileNameStyle]}
|
|
332
|
+
>
|
|
333
|
+
{attachment.getName()}
|
|
334
|
+
</Text>
|
|
335
|
+
|
|
336
|
+
{/* Seek track (draggable) with the download button on its right — design §8.1a */}
|
|
337
|
+
<View style={{ flexDirection: 'row', alignItems: 'center', gap: S.s2, marginTop: S.s0_5 }}>
|
|
338
|
+
<View
|
|
339
|
+
style={{ flex: 1, height: S.s6, justifyContent: 'center' }}
|
|
340
|
+
onLayout={onTrackLayout}
|
|
341
|
+
{...panResponder.panHandlers}
|
|
342
|
+
>
|
|
343
|
+
<View style={[{ height: TRACK_H, borderRadius: TRACK_H / 2, backgroundColor: trackBg }, seekTrackStyle]}>
|
|
344
|
+
<View
|
|
345
|
+
style={[{
|
|
346
|
+
position: 'absolute',
|
|
347
|
+
left: 0,
|
|
348
|
+
top: 0,
|
|
349
|
+
bottom: 0,
|
|
350
|
+
width: `${progressRatio * 100}%`,
|
|
351
|
+
borderRadius: TRACK_H / 2,
|
|
352
|
+
backgroundColor: fillColor,
|
|
353
|
+
}, seekProgressStyle]}
|
|
354
|
+
/>
|
|
355
|
+
</View>
|
|
356
|
+
<View
|
|
357
|
+
pointerEvents="none"
|
|
358
|
+
style={[{
|
|
359
|
+
position: 'absolute',
|
|
360
|
+
// Clamp fully inside the track so the thumb never spills past the right edge.
|
|
361
|
+
left: Math.max(0, Math.min(progressRatio * trackWidth - THUMB / 2, trackWidth - THUMB)),
|
|
362
|
+
width: THUMB,
|
|
363
|
+
height: THUMB,
|
|
364
|
+
borderRadius: THUMB / 2,
|
|
365
|
+
backgroundColor: fillColor,
|
|
366
|
+
}, seekThumbStyle]}
|
|
367
|
+
/>
|
|
368
|
+
</View>
|
|
369
|
+
<TouchableOpacity
|
|
370
|
+
onPress={download}
|
|
371
|
+
hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
|
|
372
|
+
accessibilityRole="button"
|
|
373
|
+
accessibilityLabel="Download audio"
|
|
374
|
+
>
|
|
375
|
+
<Icon name="download-fill" size={S.s5} color={downloadColor as string} imageStyle={downloadIconStyle} />
|
|
376
|
+
</TouchableOpacity>
|
|
377
|
+
</View>
|
|
378
|
+
|
|
379
|
+
<Text
|
|
380
|
+
allowFontScaling={false}
|
|
381
|
+
style={[{ ...theme.typography.caption2.regular, color: timeColor, marginTop: S.s0_5 }, timeTextStyle]}
|
|
382
|
+
>
|
|
383
|
+
{`${fmt(displayCur)}/${fmt(duration)}`}
|
|
384
|
+
</Text>
|
|
385
|
+
</View>
|
|
386
|
+
</View>
|
|
387
|
+
);
|
|
388
|
+
};
|
|
389
|
+
|
|
390
|
+
interface AudioFileCardProps {
|
|
391
|
+
attachment: CometChat.Attachment;
|
|
392
|
+
isSentByMe: boolean;
|
|
393
|
+
theme: CometChatTheme;
|
|
394
|
+
containerStyle?: StyleProp<ViewStyle>;
|
|
395
|
+
fileNameStyle?: TextStyle;
|
|
396
|
+
downloadIconStyle?: ImageStyle;
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
// Unsupported audio (a format the native player can't render) → a plain file card: the "no preview"
|
|
400
|
+
// icon + file name + download. No player, no seek bar, and no MIME/type label — per design §8.1a.
|
|
401
|
+
const AudioFileCard = ({
|
|
402
|
+
attachment,
|
|
403
|
+
isSentByMe,
|
|
404
|
+
theme,
|
|
405
|
+
containerStyle,
|
|
406
|
+
fileNameStyle,
|
|
407
|
+
downloadIconStyle,
|
|
408
|
+
}: AudioFileCardProps) => {
|
|
409
|
+
const S = theme.spacing.spacing;
|
|
410
|
+
const url = attachment.getUrl();
|
|
411
|
+
const nameColor = isSentByMe ? theme.color.sendBubbleText : theme.color.receiveBubbleText;
|
|
412
|
+
const downloadColor = isSentByMe ? theme.color.sendBubbleIcon : theme.color.receiveBubbleIcon;
|
|
413
|
+
const download = () => {
|
|
414
|
+
if (url) FileManager?.checkAndDownload?.(url, attachment.getName(), () => {});
|
|
415
|
+
};
|
|
416
|
+
return (
|
|
417
|
+
<View testID="bubble-audio" style={[{ flexDirection: 'row', alignItems: 'center', gap: S.s2 }, containerStyle]}>
|
|
418
|
+
{/* "No preview available" file icon (unmapped/unsupported). */}
|
|
419
|
+
<Icon name="unknown-file-type" size={S.s8} />
|
|
420
|
+
<Text
|
|
421
|
+
numberOfLines={1}
|
|
422
|
+
ellipsizeMode="middle"
|
|
423
|
+
style={[{ ...theme.typography.body.medium, color: nameColor, flex: 1, minWidth: 0 }, fileNameStyle]}
|
|
424
|
+
>
|
|
425
|
+
{attachment.getName()}
|
|
426
|
+
</Text>
|
|
427
|
+
<TouchableOpacity
|
|
428
|
+
onPress={download}
|
|
429
|
+
hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
|
|
430
|
+
accessibilityRole="button"
|
|
431
|
+
accessibilityLabel="Download audio"
|
|
432
|
+
>
|
|
433
|
+
<Icon name="download-fill" size={S.s5} color={downloadColor as string} imageStyle={downloadIconStyle} />
|
|
434
|
+
</TouchableOpacity>
|
|
435
|
+
</View>
|
|
436
|
+
);
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
export interface CometChatAudiosBubbleProps {
|
|
440
|
+
message: CometChat.MediaMessage;
|
|
441
|
+
theme: CometChatTheme;
|
|
442
|
+
style?: CometChatTheme["audiosBubbleStyles"];
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
/**
|
|
446
|
+
* Renders a shared/picked audio-file message (audio with NO metadata.audioType, after the
|
|
447
|
+
* §7 fan-out) as WhatsApp-style headphone+filename player card(s), with a caption on the
|
|
448
|
+
* message. Recorded voice notes use the waveform bubble (CometChatVoiceNoteBubble) instead.
|
|
449
|
+
*/
|
|
450
|
+
export function CometChatAudiosBubble({
|
|
451
|
+
message,
|
|
452
|
+
theme,
|
|
453
|
+
style,
|
|
454
|
+
}: CometChatAudiosBubbleProps) {
|
|
455
|
+
const compTheme = useCompTheme();
|
|
456
|
+
const s = deepMerge(
|
|
457
|
+
theme.audiosBubbleStyles ?? {},
|
|
458
|
+
compTheme.audiosBubbleStyles ?? {},
|
|
459
|
+
style ?? {}
|
|
460
|
+
);
|
|
461
|
+
const { t } = useCometChatTranslation();
|
|
462
|
+
const [expanded, setExpanded] = useState(false);
|
|
463
|
+
// An AUDIO message renders ALL its attachments; a non-playable one (unsupported audio format, or a
|
|
464
|
+
// non-audio image/video/file) drops to the AudioFileCard "no preview" card below. getAttachments()
|
|
465
|
+
// preserves pick order.
|
|
466
|
+
const allAttachments = useMemo(
|
|
467
|
+
() => (message.getAttachments?.() ?? []).filter((a) => a != null && typeof a.getUrl === 'function'),
|
|
468
|
+
[message]
|
|
469
|
+
);
|
|
470
|
+
const caption = message.getCaption() ?? '';
|
|
471
|
+
const isSentByMe = message.getSender()?.getUid() === CometChatUIKit.loggedInUser?.getUid();
|
|
472
|
+
// A "collection" (2+ items) renders each in its own lighter inner card; a SINGLE item
|
|
473
|
+
// sits directly on the message bubble (the bubble is its card) — per design (single vs multiple).
|
|
474
|
+
const isCollection = allAttachments.length > 1;
|
|
475
|
+
|
|
476
|
+
if (allAttachments.length === 0) return null;
|
|
477
|
+
|
|
478
|
+
// Collapse long collections behind a "Show N more" toggle (ENG-37024).
|
|
479
|
+
const visibleAudios =
|
|
480
|
+
expanded || allAttachments.length <= ATTACHMENT_COLLAPSED_LIMIT
|
|
481
|
+
? allAttachments
|
|
482
|
+
: allAttachments.slice(0, ATTACHMENT_COLLAPSED_LIMIT);
|
|
483
|
+
const hiddenCount = allAttachments.length - ATTACHMENT_COLLAPSED_LIMIT;
|
|
484
|
+
const showExpandButton = allAttachments.length > ATTACHMENT_COLLAPSED_LIMIT;
|
|
485
|
+
const expandBg = isSentByMe ? theme.color.extendedPrimary800 : theme.color.neutral100;
|
|
486
|
+
const expandAccent = isSentByMe ? theme.color.staticWhite : theme.color.primary;
|
|
487
|
+
|
|
488
|
+
return (
|
|
489
|
+
<View style={{ width: '100%' }}>
|
|
490
|
+
{visibleAudios.map((att, i) => {
|
|
491
|
+
const key = att.getUrl() ?? String(i);
|
|
492
|
+
// Playable format → the player; unsupported format → a plain file card (no player / seek bar).
|
|
493
|
+
const inner = isPlayableAudio(att) ? (
|
|
494
|
+
<AudioFilePlayer
|
|
495
|
+
attachment={att}
|
|
496
|
+
isSentByMe={isSentByMe}
|
|
497
|
+
theme={theme}
|
|
498
|
+
containerStyle={s.containerStyle}
|
|
499
|
+
playButtonStyle={s.playButtonStyle}
|
|
500
|
+
playIconStyle={s.playIconStyle}
|
|
501
|
+
fileNameStyle={s.fileNameStyle}
|
|
502
|
+
seekTrackStyle={s.seekTrackStyle}
|
|
503
|
+
seekProgressStyle={s.seekProgressStyle}
|
|
504
|
+
seekThumbStyle={s.seekThumbStyle}
|
|
505
|
+
timeTextStyle={s.timeTextStyle}
|
|
506
|
+
downloadIconStyle={s.downloadIconStyle}
|
|
507
|
+
/>
|
|
508
|
+
) : (
|
|
509
|
+
<AudioFileCard
|
|
510
|
+
attachment={att}
|
|
511
|
+
isSentByMe={isSentByMe}
|
|
512
|
+
theme={theme}
|
|
513
|
+
containerStyle={s.containerStyle}
|
|
514
|
+
fileNameStyle={s.fileNameStyle}
|
|
515
|
+
downloadIconStyle={s.downloadIconStyle}
|
|
516
|
+
/>
|
|
517
|
+
);
|
|
518
|
+
// SINGLE audio → sits directly on the message bubble (no inner card).
|
|
519
|
+
if (!isCollection) {
|
|
520
|
+
return <React.Fragment key={key}>{inner}</React.Fragment>;
|
|
521
|
+
}
|
|
522
|
+
// COLLECTION (2+) → each audio in its own lighter, rounded card, with a gap between them.
|
|
523
|
+
return (
|
|
524
|
+
<View
|
|
525
|
+
key={key}
|
|
526
|
+
style={[{
|
|
527
|
+
backgroundColor: isSentByMe ? theme.color.extendedPrimary800 : theme.color.neutral100,
|
|
528
|
+
borderRadius: theme.spacing.radius.r3,
|
|
529
|
+
padding: theme.spacing.padding.p3,
|
|
530
|
+
// keep the gap on the last visible card too when the expand button follows it
|
|
531
|
+
marginBottom: i < visibleAudios.length - 1 || showExpandButton ? theme.spacing.margin.m2 : 0,
|
|
532
|
+
}, s.cardStyle]}
|
|
533
|
+
>
|
|
534
|
+
{inner}
|
|
535
|
+
</View>
|
|
536
|
+
);
|
|
537
|
+
})}
|
|
538
|
+
{/* ENG-37024 — "Show N more" / "Show less" toggle for a long audio collection,
|
|
539
|
+
matching CometChatFilesBubble (chevron first, on the card surface). */}
|
|
540
|
+
{showExpandButton && (
|
|
541
|
+
<TouchableOpacity
|
|
542
|
+
onPress={() => setExpanded(e => !e)}
|
|
543
|
+
activeOpacity={0.7}
|
|
544
|
+
style={{
|
|
545
|
+
flexDirection: 'row',
|
|
546
|
+
alignItems: 'center',
|
|
547
|
+
justifyContent: 'center',
|
|
548
|
+
gap: theme.spacing.spacing.s1,
|
|
549
|
+
backgroundColor: expandBg,
|
|
550
|
+
borderRadius: theme.spacing.radius.r3,
|
|
551
|
+
paddingVertical: theme.spacing.padding.p3,
|
|
552
|
+
paddingHorizontal: theme.spacing.padding.p3,
|
|
553
|
+
}}
|
|
554
|
+
accessibilityRole="button"
|
|
555
|
+
>
|
|
556
|
+
<Icon
|
|
557
|
+
name={expanded ? 'keyboard-arrow-up' : 'keyboard-arrow-down'}
|
|
558
|
+
size={theme.spacing.spacing.s5}
|
|
559
|
+
color={expandAccent as string}
|
|
560
|
+
/>
|
|
561
|
+
<Text style={[{ ...theme.typography.body.medium, color: expandAccent }, s.expandButtonTextStyle]}>
|
|
562
|
+
{expanded
|
|
563
|
+
? (t('FILE_LIST_SHOW_LESS') ?? 'Show less')
|
|
564
|
+
: (t('FILE_LIST_SHOW_MORE') ?? `Show ${hiddenCount} more`).replace('{count}', String(hiddenCount))}
|
|
565
|
+
</Text>
|
|
566
|
+
</TouchableOpacity>
|
|
567
|
+
)}
|
|
568
|
+
{/* §7 — caption rides on the (last) message of the batch */}
|
|
569
|
+
{Boolean(caption) && (
|
|
570
|
+
<CometChatCaptionText
|
|
571
|
+
message={message}
|
|
572
|
+
caption={caption}
|
|
573
|
+
theme={theme}
|
|
574
|
+
containerStyle={{
|
|
575
|
+
paddingHorizontal: theme.spacing.padding.p3,
|
|
576
|
+
paddingTop: theme.spacing.padding.p2,
|
|
577
|
+
paddingBottom: theme.spacing.padding.p1,
|
|
578
|
+
}}
|
|
579
|
+
textStyle={[{
|
|
580
|
+
...theme.typography.body.regular,
|
|
581
|
+
color: isSentByMe ? theme.color.staticWhite : theme.color.neutral900,
|
|
582
|
+
}, s.captionStyle]}
|
|
583
|
+
/>
|
|
584
|
+
)}
|
|
585
|
+
</View>
|
|
586
|
+
);
|
|
587
|
+
}
|
|
@@ -3,7 +3,6 @@ import React, {
|
|
|
3
3
|
useEffect,
|
|
4
4
|
useImperativeHandle,
|
|
5
5
|
useRef,
|
|
6
|
-
useState,
|
|
7
6
|
} from "react";
|
|
8
7
|
import {
|
|
9
8
|
Animated,
|
|
@@ -93,11 +92,6 @@ const CometChatBottomSheet = forwardRef(
|
|
|
93
92
|
|
|
94
93
|
// All hooks called unconditionally at top level
|
|
95
94
|
const overlayAnim = useRef(new Animated.Value(0)).current;
|
|
96
|
-
const [isModalOpen, setIsModalOpen] = useState(isOpen);
|
|
97
|
-
|
|
98
|
-
useEffect(() => {
|
|
99
|
-
setIsModalOpen(isOpen);
|
|
100
|
-
}, [isOpen]);
|
|
101
95
|
|
|
102
96
|
// Fade in/out the overlay when isOpen changes
|
|
103
97
|
useEffect(() => {
|
|
@@ -158,7 +152,11 @@ const CometChatBottomSheet = forwardRef(
|
|
|
158
152
|
animationType="fade"
|
|
159
153
|
transparent={true}
|
|
160
154
|
hardwareAccelerated={true}
|
|
161
|
-
|
|
155
|
+
// Bind directly to isOpen so the modal closes on the render commit. Mirroring
|
|
156
|
+
// isOpen into internal state via a passive effect made the close unreliable:
|
|
157
|
+
// launching a native picker backgrounds the activity and React defers the
|
|
158
|
+
// effect, so the sheet stayed open. Direct binding closes it synchronously.
|
|
159
|
+
visible={isOpen}
|
|
162
160
|
onRequestClose={togglePanel}
|
|
163
161
|
onDismiss={onDismiss}
|
|
164
162
|
supportedOrientations={["portrait", "landscape"]}
|