Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ios WindowInsets.ime.getBottom return random LAST value when keyboard hide event #4618

Closed
slartus opened this issue Apr 15, 2024 · 0 comments · Fixed by JetBrains/compose-multiplatform-core#1199
Assignees
Labels
bug Something isn't working ios

Comments

@slartus
Copy link

slartus commented Apr 15, 2024

Describe the bug
WindowInsets.ime.getBottom return random LAST value on keyboard hide event

Affected platforms

  • iOS

Versions

  • Kotlin version*: 1.9.22
  • Compose Multiplatform version*: 1.6.2
  • OS version(s)* (required for Desktop and iOS issues): iOS 17

To Reproduce

fun App() {
    MaterialTheme {
        val keyboardController = LocalSoftwareKeyboardController.current
        Column(Modifier.fillMaxWidth(), horizontalAlignment = Alignment.CenterHorizontally) {
            TextField(
                value = "",
                onValueChange = {

                },
                label = { Text("Label") }
            )
            Text(
                text = "padding = ${KeyboardPadding().toString()}"
            )
            Button(onClick = {
                keyboardController?.hide()

            }) {
                Text("Hide keyboard")
            }
        }
    }
}

ios target:

@Composable
actual fun KeyboardPadding(): Int {
    return WindowInsets.ime.getBottom(LocalDensity.current)
}

Additional context

Screen.Recording.2024-04-15.at.09.34.32.mov
@slartus slartus added bug Something isn't working submitted labels Apr 15, 2024
@MatkovIvan MatkovIvan added ios and removed submitted labels Apr 15, 2024
ASalavei added a commit to JetBrains/compose-multiplatform-core that referenced this issue Apr 15, 2024
## Proposed Changes
- Extract keyboard listener to a separate class object.
- Use keyboard observer to handle scene offset for each compose layer
  
  Fixes JetBrains/compose-multiplatform#4016
  Fixes JetBrains/compose-multiplatform#4618
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working ios
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants