Fix tap knockable room and custom keyboard did show scrolling (#3603)

* making knockable rooms tappable

* added a way to customise the keyboard scrolling

in case we want the focussed view/textview to display something outside its content

* better documentation
This commit is contained in:
Mauro
2024-12-11 16:09:52 +01:00
committed by GitHub
parent 4931ad0ed3
commit 9856e3e5b4
6 changed files with 64 additions and 28 deletions
@@ -15,6 +15,7 @@ struct CreateRoomScreen: View {
private enum Focus {
case name
case topic
case alias
}
private var aliasBinding: Binding<String> {
@@ -52,6 +53,7 @@ struct CreateRoomScreen: View {
.toolbar { toolbar }
.readFrame($frame)
.alert(item: $context.alertInfo)
.shouldScrollOnKeyboardDidShow(focus == .alias, to: Focus.alias)
}
private var roomSection: some View {
@@ -197,6 +199,8 @@ struct CreateRoomScreen: View {
TextField("", text: aliasBinding)
.textInputAutocapitalization(.never)
.autocorrectionDisabled()
.textContentType(.URL)
.focused($focus, equals: .alias)
.tint(.compound.iconAccentTertiary)
.font(.compound.bodyLG)
.foregroundStyle(.compound.textPrimary)
@@ -209,6 +213,7 @@ struct CreateRoomScreen: View {
.environment(\.layoutDirection, .leftToRight)
.errorBackground(!context.viewState.aliasErrors.isEmpty)
})
.id(Focus.alias)
} header: {
Text(L10n.screenCreateRoomRoomAddressSectionTitle)
.compoundListSectionHeader()