mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Fix: on iPad swapping apps resets the currently written text of the composer (#2323)
This commit is contained in:
@@ -29,6 +29,7 @@ struct ComposerToolbar: View {
|
|||||||
@FocusState private var composerFocused: Bool
|
@FocusState private var composerFocused: Bool
|
||||||
@State private var frame: CGRect = .zero
|
@State private var frame: CGRect = .zero
|
||||||
@Environment(\.verticalSizeClass) private var verticalSizeClass
|
@Environment(\.verticalSizeClass) private var verticalSizeClass
|
||||||
|
@State private var hasAlreadyAppeared = false
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
VStack(spacing: 8) {
|
VStack(spacing: 8) {
|
||||||
@@ -174,7 +175,11 @@ struct ComposerToolbar: View {
|
|||||||
} editCancellationAction: {
|
} editCancellationAction: {
|
||||||
context.send(viewAction: .cancelEdit)
|
context.send(viewAction: .cancelEdit)
|
||||||
} onAppearAction: {
|
} onAppearAction: {
|
||||||
|
guard !hasAlreadyAppeared else {
|
||||||
|
return
|
||||||
|
}
|
||||||
context.send(viewAction: .composerAppeared)
|
context.send(viewAction: .composerAppeared)
|
||||||
|
hasAlreadyAppeared = true
|
||||||
}
|
}
|
||||||
.focused($composerFocused)
|
.focused($composerFocused)
|
||||||
.onChange(of: context.composerFocused) { newValue in
|
.onChange(of: context.composerFocused) { newValue in
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Composer won't reset its content the app is backgrounded on iPad.
|
||||||
Reference in New Issue
Block a user