mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-06-29 20:31:45 +00:00
feebefcdd7
A long file name took all the row width and squeezed the cancel (X) icon to zero, so the file could not be dismissed before sending. Give the file-name text the layout weight and a single line (Compose), and lineLimit(1) on iOS, so it truncates and the close icon keeps its space. Affects Android, Desktop and iOS.
41 lines
1.1 KiB
Swift
41 lines
1.1 KiB
Swift
//
|
|
// ComposeFileView.swift
|
|
// SimpleX (iOS)
|
|
//
|
|
// Created by JRoberts on 04.05.2022.
|
|
// Copyright © 2022 SimpleX Chat. All rights reserved.
|
|
//
|
|
|
|
import SwiftUI
|
|
|
|
struct ComposeFileView: View {
|
|
@EnvironmentObject var theme: AppTheme
|
|
let fileName: String
|
|
let cancelFile: (() -> Void)
|
|
let cancelEnabled: Bool
|
|
|
|
var body: some View {
|
|
HStack(alignment: .center, spacing: 4) {
|
|
Image(systemName: "doc.fill")
|
|
.resizable()
|
|
.aspectRatio(contentMode: .fit)
|
|
.frame(width: 30, height: 30)
|
|
.foregroundColor(Color(uiColor: .tertiaryLabel))
|
|
.padding(.leading, 4)
|
|
Text(fileName)
|
|
.lineLimit(1)
|
|
Spacer()
|
|
if cancelEnabled {
|
|
Button { cancelFile() } label: {
|
|
Image(systemName: "multiply")
|
|
}
|
|
}
|
|
}
|
|
.padding(.vertical, 1)
|
|
.padding(.trailing, 12)
|
|
.frame(height: 54)
|
|
.background(theme.appColors.sentMessage)
|
|
.frame(maxWidth: .infinity)
|
|
}
|
|
}
|