I've been playing with the latest versions of the compose navigation, with accompanist animations, a...
n
I've been playing with the latest versions of the compose navigation, with accompanist animations, and I have one strange transition that's happening that I can't explain which seems to transition into the top left corner of the screen, and the next screen pops back out of the corner. I'll drop a screen recording here. We haven't used anything other than the default transitions yet.
This is a sign in screen, and is above 'home' on the backstack. For reasons of supporting some deep links, we have some code that navigates back that looks like:
Copy code
val id = nav.getBackStackEntry("home").destination.id
 nav.popBackStack(id, false)
I don't think this is the cause of the strange transition though. I don't really know where to start looking for what might be happening here. What transition is that even? It's not a slide, it's not a fade.
i
Without code, I don't think there's anything we can actually help with. As of Accompanist 0.17.0 and PR 664 there, every animation triggered by Navigation is center aligned by default
👍 1
n
Okay, I'll spend a little time to see if I can make a small example. Only thought I have is this is an activity transition artifact.
z
I saw something similar a while back! I cant recall how I had broken it, but the underlying issue for me was that the target screen had a size of 0 - hence an animation like slideInVertically would slide in from the left corner instead of the center.
i
You'd generally want to set the size of your NavHost (i.e., have it fill the space available to it) rather than size based on its contents, yes
n
Yeah, so I just tried a test where I put a Box into the content, and this solves the issue, thanks @Zoltan Demant. I will also try setting the navhost size and see if that makes the transitions behave. As you have suggested, @Ian Lake.
👍🏽 1
And, the answer is, if I add a fillMaxSize modifier on the nav host, the transitions work nicely. Thanks, @Ian Lake.
👍 1
👍🏽 1
🎉 2