mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-05 03:48:27 +00:00
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:
@@ -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()
|
||||
|
||||
@@ -13,7 +13,12 @@ struct JoinRoomScreen: View {
|
||||
@Environment(\.dynamicTypeSize) private var dynamicTypeSize
|
||||
|
||||
@ObservedObject var context: JoinRoomScreenViewModel.Context
|
||||
@FocusState private var focus: Focus?
|
||||
|
||||
private enum Focus {
|
||||
case knockMessage
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
FullscreenDialog(topPadding: context.viewState.mode == .knocked ? 151 : 35, background: .bloom) {
|
||||
if context.viewState.mode == .loading {
|
||||
@@ -29,6 +34,7 @@ struct JoinRoomScreen: View {
|
||||
.backgroundStyle(.compound.bgCanvasDefault)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar { toolbar }
|
||||
.shouldScrollOnKeyboardDidShow(focus == .knockMessage, to: Focus.knockMessage)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
@@ -117,6 +123,7 @@ struct JoinRoomScreen: View {
|
||||
VStack(alignment: .leading, spacing: 12) {
|
||||
HStack(spacing: 0) {
|
||||
TextField("", text: $context.knockMessage, axis: .vertical)
|
||||
.focused($focus, equals: .knockMessage)
|
||||
.onChange(of: context.knockMessage) { _, newValue in
|
||||
context.knockMessage = String(newValue.prefix(maxKnockMessageLength))
|
||||
}
|
||||
@@ -124,6 +131,7 @@ struct JoinRoomScreen: View {
|
||||
.font(.compound.bodyMD)
|
||||
.padding(.horizontal, 16)
|
||||
.padding(.vertical, 12)
|
||||
.id(Focus.knockMessage)
|
||||
}
|
||||
.background(.compound.bgCanvasDefault)
|
||||
.cornerRadius(8)
|
||||
|
||||
Reference in New Issue
Block a user