Skip to content

Commit 9c73d7c

Browse files
Update same usage of TextController in compose
1 parent 99dad1a commit 9c73d7c

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

samples/compose-samples/src/main/java/com/squareup/sample/compose/textinput/TextInputViewFactory.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import androidx.compose.ui.unit.dp
1919
import com.squareup.sample.compose.textinput.TextInputWorkflow.Rendering
2020
import com.squareup.workflow1.ui.TextController
2121
import com.squareup.workflow1.ui.compose.ScreenComposableFactory
22-
import com.squareup.workflow1.ui.compose.asMutableState
22+
import com.squareup.workflow1.ui.compose.asMutableTextFieldValueState
2323
import com.squareup.workflow1.ui.compose.tooling.Preview
2424

2525
val TextInputComposableFactory = ScreenComposableFactory<Rendering> { rendering ->
@@ -30,14 +30,14 @@ val TextInputComposableFactory = ScreenComposableFactory<Rendering> { rendering
3030
.animateContentSize(),
3131
horizontalAlignment = Alignment.CenterHorizontally
3232
) {
33-
var text by rendering.textController.asMutableState()
33+
var textFieldValue by rendering.textController.asMutableTextFieldValueState()
3434

35-
Text(text = text)
35+
Text(text = textFieldValue.text)
3636
OutlinedTextField(
3737
label = {},
3838
placeholder = { Text("Enter some text") },
39-
value = text,
40-
onValueChange = { text = it }
39+
value = textFieldValue,
40+
onValueChange = { textFieldValue = it }
4141
)
4242
Spacer(modifier = Modifier.height(8.dp))
4343
Button(onClick = rendering.onSwapText) {

0 commit comments

Comments
 (0)