feat(ChatScreen): enhance message input and attachment handling
Some checks failed
Frontend CI / build-and-push-web (push) Successful in 8m3s
Frontend CI / ota-android (push) Successful in 11m1s
Frontend CI / build-android-apk (push) Has been cancelled

- Updated ChatInput to manage pending attachments, allowing users to upload multiple images before sending.
- Introduced functionality to remove pending attachments and display their thumbnails in the input area.
- Enhanced ChatScreen to reflect changes in attachment handling, including dynamic messaging during uploads.
- Refactored message segment rendering to support inline text and grouped images, improving visual organization.
- Added constants for maximum pending images to enforce limits on user uploads.
This commit is contained in:
lafay
2026-03-25 03:44:16 +08:00
parent 583ac64dfd
commit dc8f9061ab
7 changed files with 338 additions and 95 deletions

View File

@@ -136,9 +136,11 @@ export const ChatScreen: React.FC = () => {
currentUserId,
keyboardHeight,
loading,
sending,
isComposerBusy,
activePanel,
sendingImage,
uploadingAttachments,
pendingAttachments,
replyingTo,
longPressMenuVisible,
selectedMessage,
@@ -172,6 +174,7 @@ export const ChatScreen: React.FC = () => {
shouldShowTime,
handleInputChange,
handleSend,
removePendingAttachment,
handleMoreAction,
handleInsertEmoji,
handleSendSticker,
@@ -487,12 +490,14 @@ export const ChatScreen: React.FC = () => {
onToggleEmoji={toggleEmojiPanel}
onToggleMore={toggleMorePanel}
activePanel={activePanel}
sending={sending}
isComposerBusy={isComposerBusy}
isMuted={isMuted}
isGroupChat={isGroupChat}
muteAll={muteAll}
restrictionHint={followRestrictionHint}
replyingTo={replyingTo}
pendingAttachments={pendingAttachments}
onRemovePendingAttachment={removePendingAttachment}
onCancelReply={handleCancelReply}
onFocus={() => {
// 输入框获得焦点时,关闭其他面板(但不要关闭键盘)
@@ -529,11 +534,13 @@ export const ChatScreen: React.FC = () => {
</View>
{/* 发送图片加载遮罩 */}
{sendingImage && (
{(sendingImage || uploadingAttachments) && (
<View style={styles.overlay}>
<View style={styles.overlayContent}>
<ActivityIndicator size="large" color={colors.primary.main} />
<Text style={styles.overlayText}>...</Text>
<Text style={styles.overlayText}>
{uploadingAttachments ? '正在上传图片…' : '发送图片中…'}
</Text>
</View>
</View>
)}