diff --git a/app/lint-baseline.xml b/app/lint-baseline.xml index 12e0b4a014b..75a63bff19b 100644 --- a/app/lint-baseline.xml +++ b/app/lint-baseline.xml @@ -8240,17 +8240,6 @@ column="27"/> - - - - Unit) { this.onValueChanged = onValueChanged - if (value.text != state.text.toString() || value.selection != state.text.selection) { + if (value.text != state.text.toString() || value.selection != state.selection) { state.edit { if (value.text != state.text.toString()) { replace(0, length, value.text) } - if (value.selection != state.text.selection) { + if (value.selection != state.selection) { selection = value.selection } } @@ -89,9 +86,9 @@ internal class StateSyncingModifierNode( } private fun observeTextState(fireOnValueChanged: Boolean = true) { - lateinit var text: TextFieldCharSequence + lateinit var text: TextFieldState observeReads { - text = state.text + text = state } if (fireOnValueChanged) { val newValue = TextFieldValue( diff --git a/app/src/main/kotlin/com/wire/android/ui/common/textfield/WireTextField2.kt b/app/src/main/kotlin/com/wire/android/ui/common/textfield/WireTextField2.kt index 25c770f9ca0..355730fa508 100644 --- a/app/src/main/kotlin/com/wire/android/ui/common/textfield/WireTextField2.kt +++ b/app/src/main/kotlin/com/wire/android/ui/common/textfield/WireTextField2.kt @@ -19,7 +19,6 @@ package com.wire.android.ui.common.textfield import androidx.compose.animation.AnimatedVisibility -import androidx.compose.foundation.ExperimentalFoundationApi import androidx.compose.foundation.ScrollState import androidx.compose.foundation.background import androidx.compose.foundation.border @@ -30,7 +29,6 @@ import androidx.compose.foundation.layout.padding import androidx.compose.foundation.rememberScrollState import androidx.compose.foundation.shape.RoundedCornerShape import androidx.compose.foundation.text.BasicTextField -import androidx.compose.foundation.text.KeyboardActions import androidx.compose.foundation.text.KeyboardOptions import androidx.compose.foundation.text.input.InputTransformation import androidx.compose.foundation.text.input.TextFieldLineLimits @@ -68,11 +66,11 @@ import com.wire.android.util.ui.PreviewMultipleThemes * which take TextFieldValue or String with onValueChange callback are the previous generation ones. * This hybrid is created to allow us to still pass TextFieldValue and onValueChange callback but already use the new text input version. */ -@OptIn(ExperimentalFoundationApi::class) @Composable internal fun WireTextField2( value: TextFieldValue, onValueChange: (TextFieldValue) -> Unit, + modifier: Modifier = Modifier, placeholderText: String? = null, labelText: String? = null, labelMandatoryIcon: Boolean = false, @@ -88,7 +86,6 @@ internal fun WireTextField2( capitalization = KeyboardCapitalization.Sentences, autoCorrect = true ), - keyboardActions: KeyboardActions = KeyboardActions.Default, scrollState: ScrollState = rememberScrollState(), interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, textStyle: TextStyle = MaterialTheme.wireTypography.body01, @@ -97,7 +94,6 @@ internal fun WireTextField2( inputMinHeight: Dp = MaterialTheme.wireDimensions.textFieldMinHeight, shape: Shape = RoundedCornerShape(MaterialTheme.wireDimensions.textFieldCornerSize), colors: WireTextFieldColors = wireTextFieldColors(), - modifier: Modifier = Modifier, onSelectedLineIndexChanged: (Int) -> Unit = { }, onLineBottomYCoordinateChanged: (Float) -> Unit = { }, shouldDetectTaps: Boolean = false, @@ -116,7 +112,6 @@ internal fun WireTextField2( state = textState, textStyle = textStyle.copy(color = colors.textColor(state = state).value, textDirection = TextDirection.ContentOrLtr), keyboardOptions = keyboardOptions, - keyboardActions = keyboardActions, lineLimits = lineLimits, inputTransformation = InputTransformation.maxLength(maxTextLength), scrollState = scrollState, @@ -159,7 +154,7 @@ internal fun WireTextField2( }, onTextLayout = { it()?.let { - val lineOfText = it.getLineForOffset(textState.text.selection.end) + val lineOfText = it.getLineForOffset(textState.selection.end) val bottomYCoordinate = it.getLineBottom(lineOfText) onSelectedLineIndexChanged(lineOfText) onLineBottomYCoordinateChanged(bottomYCoordinate) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 32ae97c1b02..3f2dd503b88 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -45,8 +45,8 @@ androidx-startup = "1.1.1" # Compose composeBom = "2024.04.01" -compose-foundation = "1.7.0-alpha05" # remove when composeBom contains new stable version of BasicTextField2 -compose-material-android = "1.7.0-alpha05" # remove when composeBom contains new stable version of BasicTextField2 +compose-foundation = "1.7.0-beta01" # remove when composeBom contains new stable version of BasicTextField2 +compose-material-android = "1.7.0-beta01" # remove when composeBom contains new stable version of BasicTextField2 compose-activity = "1.8.2" compose-compiler = "1.5.11" compose-constraint = "1.0.1"