From 8865bdf64b27ccee6f27c3531e11e1f33e241e8c Mon Sep 17 00:00:00 2001 From: Xavier Molloy <44061143+xavimolloy@users.noreply.github.com> Date: Tue, 30 Jan 2024 10:27:57 +0100 Subject: [PATCH] Develop release 0.1.1 (#184) * ANDROAPP-5881-Input-with-virtual-keyboard-not-working-correctly (#178) * fix: [ANDROAPP-5881] Add textfieldComposition to textfield value to avoid infinite calls to onValueChanged * fix: [ANDROAPP-5881] Ktlint fix * fix: [ANDROAPP-5881] test fix for input age * fix: [ANDROAPP-5895] Correct misalignment when entering text in input shell (#181) --- .../hisp/dhis/mobile/ui/designsystem/component/InputField.kt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputField.kt b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputField.kt index 5a5749ac2..f64b83e06 100644 --- a/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputField.kt +++ b/designsystem/src/commonMain/kotlin/org/hisp/dhis/mobile/ui/designsystem/component/InputField.kt @@ -132,6 +132,9 @@ fun BasicTextField( var textFieldSelection by remember { mutableStateOf(TextRange(if (inputText.isEmpty()) 0 else inputText.length)) } + var textFieldComposition by remember { + mutableStateOf(if (inputText.isEmpty()) null else TextRange(0, if (inputText.isEmpty()) 0 else inputText.length)) + } CompositionLocalProvider(LocalTextSelectionColors provides customTextSelectionColors) { BasicTextField( @@ -145,9 +148,11 @@ fun BasicTextField( value = TextFieldValue( text = inputText, selection = textFieldSelection, + composition = textFieldComposition, ), onValueChange = { textFieldSelection = it.selection + textFieldComposition = it.composition onInputChanged.invoke(it.text) }, enabled = enabled,