Jetpack compose TextField soft keyboard obscures text entry

Viewed 649

When initially clicking the text field the whole view correctly shifts upwards so the keyboard is just below text entry.

enter image description here

After pressing return on the keyboard nothing on the screen moves and it leaves the cursor under the keyboard out of vision.

I had some other TextField issues that were solve by using the accompanist library. There is currently an assigned issue for it here. Here is the composable for the textField:

@Composable
fun EditTextContent(
    label: String,
    text: String,
    isError: Boolean,
    modifier: Modifier = Modifier,
    singleLine: Boolean,
    inputType: KeyboardType = KeyboardType.Text,
    onTextChanged: (String) -> Unit
) {
    val focusManager = LocalFocusManager.current
    OutlinedTextField(
        modifier = modifier.navigationBarsWithImePadding().testTag(label),
        value = text,
        onValueChange = {
            onTextChanged(it)
        },
        label = { Text(label) },
        singleLine = singleLine,
        keyboardActions = KeyboardActions(onDone = { focusManager.clearFocus() }),
        keyboardOptions = KeyboardOptions(keyboardType = inputType),
        isError = isError,
        trailingIcon = {
            if (isError) {
                Icon(
                    painter = painterResource(id = R.drawable.ic_warning),
                    modifier = Modifier.size(25.dp),
                    contentDescription = null
                )
            } else {
                null
            }
        },
    )
}

Activity in the manifest is set to android:windowSoftInputMode="adjustPan" since adjustResize does nothing for some reason. Any help would be appreciated.

0 Answers
Related