compose-multiplatform icon indicating copy to clipboard operation
compose-multiplatform copied to clipboard

[Dialog] - BasicAlertDialog weird sqeeze animation when showing soft keybaord

Open cmpeguerog opened this issue 1 year ago • 2 comments

Describe the bug Dialog layout sqeeze vertically when soft keyboard is being show.

Affected platforms

  • iOS

Versions

  • Kotlin version*: 1.9.23
  • Compose Multiplatform version*: 1.6.10-beta03
  • OS version(s)* (required for Desktop and iOS issues): Ventura 13.6.6
  • OS architecture (x86 or arm64): x86
  • Device (model or simulator for iOS issues): Simulator iPhone 15 Pro running iOS 17.2, iPhone 12 Pro Max running 17.4.1.

To Reproduce

  1. Add a TextField inside a BasicAlertDialog
  2. Request focus to show keyboard as soon as the dialog appears in the composition.

Expected behavior Dialog should slide up without squeeze animation.

Screenshots

https://github.com/JetBrains/compose-multiplatform/assets/22971874/f358cc94-5438-464f-84a0-578c16f8e2d4

cmpeguerog avatar May 02 '24 12:05 cmpeguerog

It's a known issue and there was a try to migrate this - https://github.com/JetBrains/compose-multiplatform-core/pull/1099

The problem is in low-level sync between native view layout and metal layer rendering.

The current workaround is to disable platform layers via

ComposeUIViewController(
    configure = { platformLayers = false }
)

MatkovIvan avatar May 02 '24 14:05 MatkovIvan

It's a known issue and there was a try to migrate this - JetBrains/compose-multiplatform-core#1099

The problem is in low-level sync between native view layout and metal layer rendering.

The current workaround is to disable platform layers via

ComposeUIViewController(
    configure = { platformLayers = false }
)

Worked fine, but as a side effect now the user should handle the keyboad when showing dialogs.

cmpeguerog avatar May 02 '24 16:05 cmpeguerog

@cmpeguerog My problem is something similar to this, but as you can see in the image below, the BasicAlertDialog is below the keyboard.

I have already added the ComposeUIViewController

configure = {
platformLayers = false
onFocusBehavior = OnFocusBehavior.DoNothing
},

355980157-04645589-de65-438e-8388-a834c7c5ee03

In Android

Screenshot_20240807_185622

How did you get the dialog to resize correctly?

Another strange thing is that the density of text and component sizes on iOS seems to get bigger.

SirFilbido avatar Aug 07 '24 21:08 SirFilbido

@SirFilbido I just added the platformLayers = false.

cmpeguerog avatar Aug 07 '24 23:08 cmpeguerog

@cmpeguerog Does your BasicAlertDialog have any settings in the Modifier?

SirFilbido avatar Aug 08 '24 13:08 SirFilbido

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

okushnikov avatar Aug 26 '24 13:08 okushnikov

Fixed by https://github.com/JetBrains/compose-multiplatform-core/pull/1515

MatkovIvan avatar Sep 16 '24 11:09 MatkovIvan