google / accompanist

A collection of extension libraries for Jetpack Compose
https://google.github.io/accompanist
Apache License 2.0
7.43k stars 598 forks source link

[Insets] The IME is automatically hidden #884

Closed GDLock closed 2 years ago

GDLock commented 2 years ago

Describe the bug

When trying to enter text at the bottom elements, the keyboard is automatically hidden.

MainActivity.kt

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    WindowCompat.setDecorFitsSystemWindows(window, false)

    setContent {
        SampleTheme {
            ProvideWindowInsets(windowInsetsAnimationsEnabled = true) {
                Surface(color = MaterialTheme.colors.background) {

                    LazyColumn(
                        modifier = Modifier.navigationBarsWithImePadding(),
                    ) {
                        items(50) {
                            var text by remember { mutableStateOf("") }
                            TextField(
                                value = text,
                                onValueChange = { text = it }
                            )
                        }
                    }
                }
            }
        }
    }
}

AndroidManifest.xml image

Video from Redmi Note 8 Pro, Android 9 API 28

https://user-images.githubusercontent.com/57265286/142870596-cf835d4e-2666-4b63-88d7-9820f2866834.mp4

Environment:

Devices: Emulator Pixel 3a, Android 10 API 29, Redmi Note 8 Pro, Android 9 API 28

Accompanist version: 0.20.2 & 0.21.3-beta Jetpack Compose version: 1.0.5 & 1.1.0-beta03

github-actions[bot] commented 2 years ago

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days.

TheNephilim88 commented 2 years ago

Still an issue with 0.23.1

Anyone an idea how to prevent?

alexvanyo commented 2 years ago

There are two related issues here: automatically refocusing on a TextView when the IME opens, and how that behavior interacts with treating the IME as insets.

With the upstreaming of insets into androidx, both of those issues will be addressed there, and there is active work in the area. The best issue to follow would be https://issuetracker.google.com/issues/192043120