mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 16:10:00 +00:00
Clear focus when submitting forms to prevent issues with the IME keyboard. (#139)
This commit is contained in:
committed by
GitHub
parent
abec09908a
commit
811cca6289
@@ -0,0 +1 @@
|
|||||||
|
Clear focus on TextFields when submitting forms to prevent issues with the IME keyboard.
|
||||||
+10
-2
@@ -92,6 +92,14 @@ fun ChangeServerView(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
val focusManager = LocalFocusManager.current
|
val focusManager = LocalFocusManager.current
|
||||||
|
|
||||||
|
fun submit() {
|
||||||
|
// Clear focus to prevent keyboard issues with textfields
|
||||||
|
focusManager.clearFocus(force = true)
|
||||||
|
|
||||||
|
eventSink(ChangeServerEvents.Submit)
|
||||||
|
}
|
||||||
|
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = {
|
topBar = {
|
||||||
TopAppBar(
|
TopAppBar(
|
||||||
@@ -175,7 +183,7 @@ fun ChangeServerView(
|
|||||||
imeAction = ImeAction.Done,
|
imeAction = ImeAction.Done,
|
||||||
),
|
),
|
||||||
keyboardActions = KeyboardActions(
|
keyboardActions = KeyboardActions(
|
||||||
onDone = { eventSink(ChangeServerEvents.Submit) }
|
onDone = { submit() }
|
||||||
),
|
),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
@@ -216,7 +224,7 @@ fun ChangeServerView(
|
|||||||
)
|
)
|
||||||
Spacer(Modifier.height(32.dp))
|
Spacer(Modifier.height(32.dp))
|
||||||
Button(
|
Button(
|
||||||
onClick = { eventSink(ChangeServerEvents.Submit) },
|
onClick = ::submit,
|
||||||
enabled = interactionEnabled && state.submitEnabled,
|
enabled = interactionEnabled && state.submitEnabled,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
|||||||
+10
-2
@@ -223,6 +223,14 @@ internal fun LoginForm(
|
|||||||
|
|
||||||
val focusManager = LocalFocusManager.current
|
val focusManager = LocalFocusManager.current
|
||||||
val eventSink = state.eventSink
|
val eventSink = state.eventSink
|
||||||
|
|
||||||
|
fun submit() {
|
||||||
|
// Clear focus to prevent keyboard issues with textfields
|
||||||
|
focusManager.clearFocus(force = true)
|
||||||
|
|
||||||
|
eventSink(LoginRootEvents.Submit)
|
||||||
|
}
|
||||||
|
|
||||||
Column(modifier) {
|
Column(modifier) {
|
||||||
Text(
|
Text(
|
||||||
text = stringResource(StringR.string.login_form_title),
|
text = stringResource(StringR.string.login_form_title),
|
||||||
@@ -301,7 +309,7 @@ internal fun LoginForm(
|
|||||||
imeAction = ImeAction.Done,
|
imeAction = ImeAction.Done,
|
||||||
),
|
),
|
||||||
keyboardActions = KeyboardActions(
|
keyboardActions = KeyboardActions(
|
||||||
onDone = { eventSink(LoginRootEvents.Submit) }
|
onDone = { submit() }
|
||||||
),
|
),
|
||||||
singleLine = true,
|
singleLine = true,
|
||||||
maxLines = 1,
|
maxLines = 1,
|
||||||
@@ -310,7 +318,7 @@ internal fun LoginForm(
|
|||||||
|
|
||||||
// Submit
|
// Submit
|
||||||
Button(
|
Button(
|
||||||
onClick = { eventSink(LoginRootEvents.Submit) },
|
onClick = ::submit,
|
||||||
enabled = interactionEnabled && state.submitEnabled,
|
enabled = interactionEnabled && state.submitEnabled,
|
||||||
modifier = Modifier
|
modifier = Modifier
|
||||||
.fillMaxWidth()
|
.fillMaxWidth()
|
||||||
|
|||||||
Reference in New Issue
Block a user