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

[Navigation Animation] With compose 1.4.0-beta02 keyboard has extra padding that overlaps the content #1531

Closed polivmi1 closed 1 year ago

polivmi1 commented 1 year ago

Description

With the new Compose release, there is a bug when contentAlignment = Alignment.TopCenter is added to the AnimatedNavHost. It will cause after 1 screen transition there to be space above the keyboard. Removing it or downgrading compose would fix the problem.

Here is a sample project to reproduce:

Here is a screenshot https://github.com/polivmi1/Bug270656245/blob/master/app/src/Screenshot%202023-03-02%20at%2021.52.10.png (happens both for the library and accompanist version as the library only wraps the accompanist)

Here are the findings where I thought other library is a problem:

https://github.com/raamcosta/compose-destinations/issues/375

alexvanyo commented 1 year ago

The main insets library in accompanist is deprecated, as it has been superceded by support in androidx directly, so if there's an issue with the underlying insets behavior please report an issue there.

Are you calling both WindowCompat.setDecorFitsSystemWindows(window, false) and using windowSoftInputMode of adjustResize?

polivmi1 commented 1 year ago

@alexvanyo this is not using the deprecated inset. It might be confusing because of the title. This is just a specific bug on the keyboard that is related to insets. There is no need to call anything insets related in this case as it does work correctly in previous compose release or without the contentAlignment = Alignment.TopCenter set on the AnimatedNavHost. It seems that accompanist animation internally uses something to set some animation inset that later causes this weird behavior that only happens after at least one screen transition with contentAlignment = Alignment.TopCenter happens.

Please see the sample project which reproduces it.

alexvanyo commented 1 year ago

Thanks for adding information, reopening and assigning over to navigation.

jbw0033 commented 1 year ago

The only thing that AnimatedNavHost does is pass the contentAlignment directly to the AnimatedContent, which is no longer experimental in Compose 1.5, please file a bug against the Compose Animation library in androidx.