Status Update
Comments
jb...@google.com <jb...@google.com> #2
Hey Doris, any ideas on where this random animation could be coming from?
ti...@google.com <ti...@google.com> #3
Re
I tried the repro project locally. I was not able to reproduce in the the tip of tree compose code base, after dozens of attempts. It's possible the issue has been fixed recently.
Could you try the latest androidx snapshot here:
il...@gmail.com <il...@gmail.com> #4
Hi! Thank you for checking into it and giving it a try.
Unfortunately, the issue is still reproducible with snapshot 12123985, 2.8.0-SNAPSHOT for navigation, and 1.8.0-SNAPSHOT for compose.
I've pushed an update containing SNAPSHOT dependencies and automated reproduction attempts:
Now, it's sufficient to launch the application and wait.
Here's a new video:
ti...@google.com <ti...@google.com> #5
Thanks for the repro in
Initial investigation showed that the enter/exit transitions are correct. What appears like a scale animation is a size transform. During the repeated destination change, there seems to be a frame where the new content is resolved into an empty list of measurables, which is incorrect.
Unclear what's causing this yet - either the content composable is not yet populated for that frame, or the UI tree applier deferred adding the nodes to the tree to the next frame. More investigation will be needed.
ti...@google.com <ti...@google.com> #6
The content composable is indeed empty. It comes from currentEntry
being null here:
Over to Jeremy to investigate further in Navigation.
al...@gmail.com <al...@gmail.com> #7
ho...@gmail.com <ho...@gmail.com> #8
es...@gmail.com <es...@gmail.com> #9
I'm also experiencing this issue using Navigation Compose 2.8.3
It also happens with the default animation with null transition arguments. Sometimes it just animates through scale in.
pr...@gmail.com <pr...@gmail.com> #10
Likely this is the same issue as
al...@gmail.com <al...@gmail.com> #11
cl...@gmail.com <cl...@gmail.com> #12
I'm still experiencing this issue in my app as of version 2.8.4. Seemingly at random I'll see a scale animation from the top left instead of my custom one.
Feel free to reference it here:
ap...@google.com <ap...@google.com> #13
Project: platform/frameworks/support
Branch: androidx-main
Author: Jeremy Woods <
Link:
Stop incorrect scaling animation when using NavHost
Expand for full commit details
Stop incorrect scaling animation when using NavHost
There is a case where if you can trigger a navigate call right before the
LaunchEffect that is responsible for managing the end of the
AnimatedContent's transition is called, you will get an incorrect scale
animation.
The reason for this is that the call to navigate adds the proper entries
to the visibleEntries list and then the LaunchedEffect immediately
remove it. Then when the AnimatedContent attempts to find this removed
entry it is not there and AnimatedContent thinks it is animated from
nothing and just scales from a blank screen.
Since this is an interrupt case the the AnimatedContent has not actually
finsihed with transition, we should not be hitting the `LaunchedEffect`
and marking the transition complete at all, but that needs to be
addressed by the Animation library so this change provides a workaround
in the mean time that just keeps from incorrectly marking the visible
entry's transition as complete.
RelNote: "Added a workaround to fix an issue that caused an unexpected
scale animation when using Navigation Compose."
Test: tested in sample app
Bug: 353294030
Change-Id: I26cb142affb046e94b34b9501e5405ddcf276fcf
Files:
- M
navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
Hash: c270d4e53585ab6033d53a2eef1f5327da39e20d
Date: Thu Dec 05 23:09:52 2024
ap...@google.com <ap...@google.com> #14
Project: platform/frameworks/support
Branch: androidx-main
Author: Jeremy Woods <
Link:
Avoid race condition for transitions in NavHost
Expand for full commit details
Avoid race condition for transitions in NavHost
This is cleaning up the code added in aosp/3393408. The issue is caused
by a race condition where the previous animation has ended but the
current animation has yet to start because `animateTo` is still waiting
to acquire the `mutatorMutex`.
We need to verify that what `AnimatedContent` believes is the
`targetState` is the same thing that is on top of the back stack before
we mark the entries as complete.
RelNote: "Fix an issue that caused an unexpected scale animation when
using Navigation Compose."
Test: tested extensively in sample app
Bug: 353294030
Change-Id: I480f4d89ffc7e2dfa536a592a8fc7b6c759be1a4
Files:
- M
navigation/navigation-compose/src/main/java/androidx/navigation/compose/NavHost.kt
Hash: 4fbe698e1ff01037c6ed1a74538c0c1628ac1730
Date: Fri Dec 06 01:10:47 2024
jb...@google.com <jb...@google.com> #15
This has been fixed internally and will be available in the Navigation 2.8.5
release.
pr...@google.com <pr...@google.com> #16
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-compose:2.8.5
cl...@gmail.com <cl...@gmail.com> #17
Seems solid on my end
na...@google.com <na...@google.com> #18
The following release(s) address this bug.It is possible this bug has only been partially addressed:
androidx.navigation:navigation-compose:2.9.0-alpha05
Description
Component used: Navigation Compose
Version used: 2.8.0-beta05
Devices/Android versions reproduced on: Emulators, Pixel 8 Pro
Hello!
We occasionally encounter an issue where the NavHost randomly applies a default transition animation instead of the one specified for a particular composable/route. Please take a look at the sample project and screen recording I've attached. Even though composable<DefaultRoute> consistently defines slideInHorizontally/slideOutHorizontally transitions, you may sometimes observe a scale/fade animation instead. This bug is inconsistent and may require multiple attempts to reproduce. One observation is that this issue occurs more frequently when a new transition is requested just as the enter animation of a previous one is nearing completion.
Sample project:https://github.com/smelfungus/NavHostAnimationIssue
Screen recording:https://drive.google.com/file/d/1FPZavURTkuPmnAWJ49pFhIWvz3Qq-M7x/view?usp=sharing