Related to this StackOverflow post (not mine).
In my chat view:
ScrollView(showsIndicators: false) {
messagesView
}
.safeAreaInset(edge: .bottom) { composerView }
.scrollDismissesKeyboard(.interactively)
Using interactively keyboard dismissing won't change the safe area size interactively causing a weird UI glitch like you can see in the post up above.
The keyboard and composer play nice when I use it as tool bar, But I want my composer to always be visible (obviously), I've tried to play with FocusState
to change the composer parent:
.toolbar {
ToolbarItem(placement: $isFocused ? .keyboard : .bottomBar) {
bottomView
}
}
But not only it redraws the view each time, it will also make the view lose its focus state, affectively releasing the keyboard. Plus it feels kind of a hack.
What is the right way to make the composer move with the keyboard interactively and stay on screen while the keyboard is gone, like in iMessages?