nowinandroid icon indicating copy to clipboard operation
nowinandroid copied to clipboard

[Bug]: Scroll jumps up after navigating

Open nilsi opened this issue 1 year ago • 6 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Is there a StackOverflow question about this issue?

  • [X] I have searched StackOverflow

What happened?

After navigating to another page and then hitting back the UI scrolls up a bit.

This only happens when the list is scrolled all the way to the bottom. Any ideas why this happens?

Its on an Samsung S22 Ultra running Android 13.

https://github.com/android/nowinandroid/assets/793881/1f9fe6e1-9b18-49a3-bd59-980624c7d82b

Relevant logcat output

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

nilsi avatar Aug 31 '23 10:08 nilsi

It seems like the behavior has to do with the TopAppBar.

if the scroll distance to bottom is smaller than appbar height it will end up scrolled one appbar height from bottom.

This is due to the navigation changes before the transition is done. So the appbar hides and pushes the scroll up I think.

nilsi avatar Aug 31 '23 11:08 nilsi

I solved this in our app by removing the top level app bar and having one app bar per screen instead of the top level destinations. So there are no hiding/showing app bars anymore.

nilsi avatar Sep 19 '23 08:09 nilsi

this issue is still actual and will be the same when showing/hiding bottom bar between switching screens - https://stackoverflow.com/questions/76284055/how-to-correctly-use-bottombar-navigationbar-for-top-level-destination-screens

any news?

@nilsi topBar can be used separately for each screen but not a bottomBar - it will destroy navigation animations (it should stay static for screens which have bottom bar) such as horizontal sliding during changing screens. Also bottomBar should not be used in each feature separately because such features should not know about other features.

that's why bottomBar should stay in top level composable anyway but how to fix the animations and scroll in this - it's a mystery.

anonym24 avatar Feb 13 '24 23:02 anonym24

I have found the problem but don't know the solution. // full screen WindowCompat.setDecorFitsSystemWindows(window, false) It seems to be causing the issue. If you have a solution, please let me know.

Chung-Chase52 avatar May 24 '24 08:05 Chung-Chase52

I solved this in our app by removing the top level app bar and having one app bar per screen instead of the top level destinations. So there are no hiding/showing app bars anymore.

This is probably what you have to do @Chung-Chase52

nilsi avatar May 24 '24 09:05 nilsi

Thank you for your response. However, I do not use TopAppBar, and after several tests, I found that downgrading the material3 version to 1.1.0-rc01 resolved the issue. Could this be a bug? @nilsi

Chung-Chase52 avatar May 30 '24 05:05 Chung-Chase52