Status Update
Comments
pa...@cardinalblue.com <pa...@cardinalblue.com> #2
It is not exactly a scale animation, but rather a clip. So first you will be able to see the middle of the screen, and as the animation is playing less and less of the screen is clipped which looks quite bad.
pa...@cardinalblue.com <pa...@cardinalblue.com> #3
jb...@google.com <jb...@google.com> #4
Do you know which version between 2.7.0-beta02
and 2.7.1
this behavior changed?
pa...@cardinalblue.com <pa...@cardinalblue.com> #5
2.7.0-beta02 - works as expected
2.7.0-rc01 - works as expected
2.7.0 - works as expected
2.7.1 - bug appears
So the bug has been introduced wit the 2.7.1 release, which only contain this relevant change:
mi...@gmail.com <mi...@gmail.com> #6
Hi, Is there any workaround for this issue without having to downgrade? We have upgraded accompanist and if we would downgrade to 2.6.0 it would affect much of our code base.
pa...@cardinalblue.com <pa...@cardinalblue.com> #7
2.7.0 works well, so you don't have to downgrade al the way to 2.6.0
il...@google.com <il...@google.com>
ti...@google.com <ti...@google.com> #8
I don't see any size/scale change using the snippet in
ti...@google.com <ti...@google.com> #9
I was able to repro the issue with the project linked in
It seems to me like a layout issue that was recently fixed, as the issue is fixed if I use a later version of the ui lib: implementation("androidx.compose.ui:ui:1.6.0-alpha03")
or newer.
pa...@cardinalblue.com <pa...@cardinalblue.com> #10
Please consider adding navigation to the compose BOM. Or at least when there's a stable release of the navigation library make sure it works well with the latest compose BOM. Updating the stable minor version of the navigation library should not break anything.
pa...@cardinalblue.com <pa...@cardinalblue.com> #11
Thanks for the info btw, I've decided to stay at 2.7.0-beta02
for now, since I know that works in my project and I am not comfortable with updating my compose ui to some alpha version
ti...@google.com <ti...@google.com> #12
Over to Jeremy for plans regarding releasing future versions of navigation.
hi...@gmail.com <hi...@gmail.com> #13
mi...@fresha.com <mi...@fresha.com> #14
ma...@gmail.com <ma...@gmail.com> #15
Another way to reproduce the issue between 2.7.0 (works) and 2.7.1 (broken) is a simple slideIntoContainer and slideOutOfContainer navigation. Hit the button in the example below fast and you'll see animations flying in from the corner instead of sliding!! (btw tested 2.7.5 and its still broken)
class MainActivity : ComponentActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContent {
MaterialTheme {
val navController = rememberNavController()
NavHost(navController = navController, startDestination = "first_screen") {
composable(
route = "first_screen",
enterTransition = {
slideIntoContainer(
towards = AnimatedContentTransitionScope.SlideDirection.Left,
)
},
exitTransition = {
slideOutOfContainer(
towards = AnimatedContentTransitionScope.SlideDirection.Left,
)
},
) {
FirstScreen {
navController.navigate("first_screen")
}
}
}
}
}
}
}
@Composable
fun FirstScreen(navigate: () -> Unit) {
Column(
modifier = Modifier.fillMaxSize(),
verticalArrangement = Arrangement.Center,
horizontalAlignment = Alignment.CenterHorizontally
) {
Button(onClick = {
navigate()
}) {
Text(text = "Navigate!")
}
}
}
jb...@google.com <jb...@google.com> #16
In 2.7.1
we provided a fix for androidx.compose.ui:ui:1.6.0-alpha03
, but since it added new APIs it cannot be backported into a point release of Compose 1.5.x
.
Once compose 1.6.0 is stable, we can bump the dependency and release a new version of Navigation with the fix, but until then you can resolve it by either bumping your own compose dependency to use 1.6.x
or continuing to use Navigation 2.7.0
if you don't need any of the fixes from the other Navigation point releases.
jb...@google.com <jb...@google.com> #17
Navigation 2.8.0-alpha01
has upgraded the Compose dependency to 1.7.0-alpha01
so this will be addressed in the next release.
j....@gmail.com <j....@gmail.com> #18
Since compose 1.6.0 is live can we have a fix for that?
ma...@gmail.com <ma...@gmail.com> #19
al...@gmail.com <al...@gmail.com> #20
ir...@gmail.com <ir...@gmail.com> #21
We have the same issue (Compose 1.6.2 and Navigation-Compose 2.7.6).
After explicitly setting the enter and exit transitions, I noticed that on some screens it was working correctly, on others it wasn't. The nav destination screens working correctly were calling the .fillMaxSize() modifier on the outermost/topmost Composable in the view composition hierarchy.
So the accidental/unwanted scale animation seems to have something to do with the sizing of the view children during layouting.
Instead of now having to add sizing modifiers to all destination Composables/screens, adding the .fillMaxSize() modifier to the NavHost itself does the trick. As a result, the specified enter and exit transitions are never overriden by whatever causes the bug.
NavHost(
modifier = Modifier.fillMaxSize(),
navController = navController,
startDestination = navController.currentBackStackEntry?.destination?.route ?: ProfileDestination.Overview.route(),
enterTransition = { fadeIn(animationSpec = tween(200)) },
exitTransition = { fadeOut(animationSpec = tween(200)) }
)
al...@gmail.com <al...@gmail.com> #22
We observe the same behaviour as described in the previous comment – if size of the NavHost was not zero and changing as a result of navigation, we can see weird left slide-in animation. So I doubt this issue is fixed
il...@google.com <il...@google.com> #23
Please make sure you've updated to the recently released
Description
Version used: 2.7.1
Devices/Android versions reproduced on: Pixel 7
Using the navigation compose in the previous version I was able to immediately navigate away from the landing screen, if the user is logged in, with a nice crossfade animation playing between my landing screen and main screen. See: it-was-working-in-2.7.0-beta02.mp4
Upon updating the experience has gotten worse: when navigating away from the landing screen (while it's enter animation hasn't finished yet), a weird inflating animation is playing. See: expanding-bug.mp4
Since these are only cross fade animations the size of the container should never change. Why does the size of the container animating for a simple crossfade animation?
Expected behavior:
Since the size of the initial screen doesn't change during it's enter transition, I would expect the second screen to only play a fade in animation without the weird clipping/size changing that's happening at the moment.
Code to reproduce: (see also NavHostBugReport.zip)
```
NavHostBugReportTheme {
// A surface container using the 'background' color from the theme
Surface(
modifier = Modifier.fillMaxSize(),
color = MaterialTheme.colorScheme.background
) {
val navController = rememberNavController()
NavHost(navController = navController, "@landing") {
navigation("landing", "@landing") {
composable("landing") {
Box(modifier = Modifier
.fillMaxSize()
.background(Color.Red))
LaunchedEffect(key1 = Unit) {
navController.navigate("main")
}
}
}
navigation("main", "@main") {
composable("main") {
Box(modifier = Modifier
.fillMaxSize()
.background(Color.Blue))
}
}
}
}
}
```
If this is a bug in the library, we would appreciate if you could attach:
- Sample project to trigger the issue. (attached: NavHostBugReport.zip)
- A screenrecord or screenshots showing the issue (if UI related).
working correctly in 2.7.0-beta02: it-was-working-in-2.7.0-beta02.mp4
working unexpectedly in 2.7.1: expanding-bug.mp4