mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:31:27 +00:00
Keyboard is kept dismissed when dismissing the actions or the attachments menu (#1141)
* keyboard is kept dismissed * no need for dispatch queue
This commit is contained in:
@@ -81,7 +81,7 @@ private struct UITextViewWrapper: UIViewRepresentable {
|
||||
textView.keyboardType = .default
|
||||
|
||||
textView.setContentCompressionResistancePriority(.defaultLow, for: .horizontal)
|
||||
|
||||
|
||||
return textView
|
||||
}
|
||||
|
||||
@@ -110,11 +110,11 @@ private struct UITextViewWrapper: UIViewRepresentable {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
DispatchQueue.main.async { // Avoid cycle detected through attribute warnings
|
||||
if focused, textView.window != nil, !textView.isFirstResponder {
|
||||
textView.becomeFirstResponder()
|
||||
}
|
||||
|
||||
if !focused, textView.isFirstResponder {
|
||||
textView.resignFirstResponder()
|
||||
} else if focused, textView.window != nil, !textView.isFirstResponder {
|
||||
textView.becomeFirstResponder()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -19,36 +19,35 @@ import SwiftUI
|
||||
struct RoomAttachmentPicker: View {
|
||||
@ObservedObject var context: RoomScreenViewModel.Context
|
||||
|
||||
@State private var showAttachmentPopover = false
|
||||
@State private var sheetContentHeight = CGFloat(0)
|
||||
|
||||
var body: some View {
|
||||
Button {
|
||||
showAttachmentPopover = true
|
||||
context.showAttachmentPopover = true
|
||||
} label: {
|
||||
Image(systemName: "plus.circle.fill")
|
||||
.font(.compound.headingLG)
|
||||
.foregroundColor(.compound.textActionPrimary)
|
||||
}
|
||||
.accessibilityIdentifier(A11yIdentifiers.roomScreen.attachmentPicker)
|
||||
.popover(isPresented: $showAttachmentPopover) {
|
||||
.popover(isPresented: $context.showAttachmentPopover) {
|
||||
VStack(alignment: .leading, spacing: 0.0) {
|
||||
Button {
|
||||
showAttachmentPopover = false
|
||||
context.showAttachmentPopover = false
|
||||
context.send(viewAction: .displayMediaPicker)
|
||||
} label: {
|
||||
PickerLabel(title: L10n.screenRoomAttachmentSourceGallery, systemImageName: "photo.fill")
|
||||
}
|
||||
|
||||
Button {
|
||||
showAttachmentPopover = false
|
||||
context.showAttachmentPopover = false
|
||||
context.send(viewAction: .displayDocumentPicker)
|
||||
} label: {
|
||||
PickerLabel(title: L10n.screenRoomAttachmentSourceFiles, systemImageName: "paperclip")
|
||||
}
|
||||
|
||||
Button {
|
||||
showAttachmentPopover = false
|
||||
context.showAttachmentPopover = false
|
||||
context.send(viewAction: .displayCameraPicker)
|
||||
} label: {
|
||||
PickerLabel(title: L10n.screenRoomAttachmentSourceCamera, systemImageName: "camera.fill")
|
||||
|
||||
@@ -99,6 +99,9 @@ struct RoomScreen: View {
|
||||
} editCancellationAction: {
|
||||
context.send(viewAction: .cancelEdit)
|
||||
}
|
||||
.onChange(of: context.actionMenuInfo) { _ in
|
||||
context.composerFocused = false
|
||||
}
|
||||
}
|
||||
|
||||
private var scrollToBottomButton: some View {
|
||||
|
||||
Reference in New Issue
Block a user