JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
16.21k stars 1.17k forks source link

iOS TextField options & actions are not used #2794

Closed codlab closed 1 year ago

codlab commented 1 year ago

Describe the bug TextFields (material or material3) do not behave as expected on iOS :

Android doesn't have those issues

Affected platforms

Versions

To Reproduce Steps and/or the code snippet to reproduce the behavior:

  1. add a TextField or OutlinedTextField in a compose view
  2. set any ImeAction, callbacks

Expected behavior When the keyboard opens, it should display the expected ime type

Screenshots

Screenshot

Additional context

Here is a snippet reproducing the issue

    val textStateUserName = remember { mutableStateOf(TextFieldValue("Default Value")) }

    TextField(
        modifier = Modifier
            .fillMaxWidth()
        value = textStateUserName.value,
        onValueChange = {
            textStateUserName.value = it
            viewModel.userNameChanged(it.text)
        },
        singleLine = true,
        maxLines = 1,
        label = { Text(text = "Username") },
        keyboardOptions = KeyboardOptions(imeAction = ImeAction.Go),
        keyboardActions = KeyboardActions {
            textStateUserName.value = TextFieldValue("onAny called")
        }
    )
dima-avdeev-jb commented 1 year ago

Options described also here:

okushnikov commented 2 months ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.