I'm having this issue with text input. Thoughts?
# compose-ios
c
I'm having this issue with text input. Thoughts?
Copy code
@Composable
fun AppTextField(
    value: String,
    onValueChange: (String) -> Unit,
    placeholder: String,
    modifier: Modifier = Modifier,
    singleLine: Boolean = true,
    minLines: Int = 1,
    keyboardOptions: KeyboardOptions = KeyboardOptions.Default,
    keyboardActions: KeyboardActions = KeyboardActions.Default,
    visualTransformation: VisualTransformation = VisualTransformation.None,
) {
    BasicTextField(
        value = value,
        onValueChange = onValueChange,
        modifier = modifier,
        singleLine = singleLine,
        minLines = minLines,
        keyboardOptions = platformTextFieldKeyboardOptions(keyboardOptions),
        keyboardActions = keyboardActions,
        visualTransformation = visualTransformation,
    )
}
Copy code
@OptIn(ExperimentalComposeUiApi::class)
actual fun platformTextFieldKeyboardOptions(options: KeyboardOptions): KeyboardOptions {
    return options.copy(
        platformImeOptions = PlatformImeOptions {
            usingNativeTextInput(true)
        },
    )
}
Copy code
kotlin = "2.4.10"
composeMultiplatform = "1.11.1"
m
Known issue. Here's the YouTrack link: youtrack.jetbrains.com/issue/CMP-7312 Workaround: use version variant with
TextFieldValue
c
danke!
j
Does this still happen when using the
TextFieldState
overload of BasicTextField? Your video makes it look like you’re experiencing an async update issue tied to how BasicTextField reacted to text changes. You can find a basic explanation here from 2022. The state backed overload is supposed to eliminate this problem.
✅ 1
c
the issue goes away when using TextFieldState