Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

POS: Dismiss Cash and Email view keyboard before the view disappears #14902

Merged
merged 5 commits into from
Jan 21, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ struct PointOfSaleCollectCashView: View {
Button(action: {
Task { @MainActor in
await posModel.cancelCashPayment()
isTextFieldFocused = false
}
}, label: {
HStack(alignment: .top) {
Expand All @@ -51,6 +52,7 @@ struct PointOfSaleCollectCashView: View {
}

FormattableAmountTextField(viewModel: textFieldViewModel, style: .pos)
.focused($isTextFieldFocused)
.onChange(of: textFieldViewModel.amount) { newValue in
textFieldAmountInput = newValue
updateChangeDueMessage()
Expand Down Expand Up @@ -80,6 +82,7 @@ struct PointOfSaleCollectCashView: View {
errorMessage = Localization.failedToCollectCashPayment
}
isLoading = false
isTextFieldFocused = false
}
}, label: {
ZStack {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ struct POSSendReceiptView: View {
@State private var textFieldInput: String = ""
@State private var isLoading: Bool = false
@State private var errorMessage: String?
@FocusState private var isTextFieldFocused: Bool

@Binding private(set) var isShowingSendReceiptView: Bool

Expand All @@ -19,6 +20,7 @@ struct POSSendReceiptView: View {
Button(action: {
withAnimation {
isShowingSendReceiptView = false
isTextFieldFocused = false
}
}, label: {
HStack {
Expand All @@ -41,6 +43,7 @@ struct POSSendReceiptView: View {
.multilineTextAlignment(.center)
.font(POSFontStyle.posTitleRegular)
.focused()
.focused($isTextFieldFocused)
.padding()
.onSubmit {
sendReceipt()
Expand Down Expand Up @@ -96,6 +99,7 @@ struct POSSendReceiptView: View {
try await posModel.sendReceipt(to: textFieldInput)
withAnimation {
isShowingSendReceiptView = false
isTextFieldFocused = false
}
} catch {
errorMessage = Localization.sendReceiptErrorText
Expand Down
Loading