Skip to content

Commit 2301700

Browse files
committed
fix: autosending voice recording
1 parent 9c832aa commit 2301700

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

package/src/components/MessageInput/components/AttachmentPreview/AttachmentUploadPreviewList.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ const UnMemoizedAttachmentUploadPreviewList = (
9393
ImageAttachmentUploadPreview,
9494
VideoAttachmentUploadPreview,
9595
} = props;
96+
const { audioRecordingSendOnComplete } = useMessageInputContext();
9697
const { attachmentManager } = useMessageComposer();
9798
const { attachments } = useAttachmentManagerState();
9899
const attachmentListRef = useRef<FlatList<LocalAttachment>>(null);
@@ -103,8 +104,11 @@ const UnMemoizedAttachmentUploadPreviewList = (
103104
const viewportWidthRef = useRef(0);
104105
const scrollOffsetXRef = useRef(0);
105106
const endShrinkCompensationX = useSharedValue(0);
106-
const audioAttachments = attachments.filter(isAudioAttachmentPreview);
107-
const nonAudioAttachments = attachments.filter(
107+
const previewAttachments = attachments.filter(
108+
(attachment) => !(audioRecordingSendOnComplete && isLocalVoiceRecordingAttachment(attachment)),
109+
);
110+
const audioAttachments = previewAttachments.filter(isAudioAttachmentPreview);
111+
const nonAudioAttachments = previewAttachments.filter(
108112
(attachment) => !isAudioAttachmentPreview(attachment),
109113
);
110114

@@ -261,7 +265,7 @@ const UnMemoizedAttachmentUploadPreviewList = (
261265
transform: [{ translateX: endShrinkCompensationX.value }],
262266
}));
263267

264-
if (!attachments.length) {
268+
if (!previewAttachments.length) {
265269
return null;
266270
}
267271

0 commit comments

Comments
 (0)