Fix: on iPad swapping apps resets the currently written text of the composer (#2323)

This commit is contained in:
Mauro
2024-01-11 17:36:19 +01:00
committed by GitHub
parent e7ab176b40
commit aee7c233b5
2 changed files with 6 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ struct ComposerToolbar: View {
@FocusState private var composerFocused: Bool
@State private var frame: CGRect = .zero
@Environment(\.verticalSizeClass) private var verticalSizeClass
@State private var hasAlreadyAppeared = false
var body: some View {
VStack(spacing: 8) {
@@ -174,7 +175,11 @@ struct ComposerToolbar: View {
} editCancellationAction: {
context.send(viewAction: .cancelEdit)
} onAppearAction: {
guard !hasAlreadyAppeared else {
return
}
context.send(viewAction: .composerAppeared)
hasAlreadyAppeared = true
}
.focused($composerFocused)
.onChange(of: context.composerFocused) { newValue in

1
changelog.d/2275.bugfix Normal file
View File

@@ -0,0 +1 @@
Composer won't reset its content the app is backgrounded on iPad.