Status Update
Comments
ti...@google.com <ti...@google.com>
ti...@google.com <ti...@google.com> #2
Andrey and Ryan,
Could you share some thoughts on this please? It's unclear to me why the icon sometimes doesn't show when animateContentSize
modifier is set on the row in the LazyColumn
. Based on my logging, the animated size always reports a size in the expected range: somewhere between icon and icon + text.
Here's a simpler repro case than the gist in #1 in case it's helpful:
LazyColumn(modifier = Modifier.fillMaxWidth()) {
items((0..30).toList()) {
var isExpanded by remember { mutableStateOf(false) }
Surface(
color = MaterialTheme.colors.primary,
shape = CircleShape
) {
Row(modifier = Modifier.animateContentSize()) {
IconButton(onClick = { isExpanded = !isExpanded }) {
Icon(asset = Icons.Default.AccessTime, tint = Color.White)
}
if (isExpanded) {
Text(
modifier = Modifier.gravity(Alignment.CenterVertically)
.padding(end = 16.dp),
text = "some text",
style = MaterialTheme.typography.caption,
color = Color.White
)
}
}
}
Spacer(modifier = Modifier.height(8.dp))
}
}
ti...@google.com <ti...@google.com> #3
As for AnimatedVisibility
, I suspect it's the same root cause.
Here I have a simple repro case with the animation essentially turned off so we rule out the possibility of alpha = 0:
After scrolling up and down a few times, you'll notice that text is missing from one (or more) of the expanded elements. (see screenshot)
an...@google.com <an...@google.com> #4
ti...@google.com <ti...@google.com> #5
Thanks for the update, Andrey.
ap...@google.com <ap...@google.com> #6
Branch: androidx-master-dev
commit 308929cf794a4e3cb1c1adca86bc62ee32ad1613
Author: Andrey Kulikov <andreykulikov@google.com>
Date: Thu Sep 03 17:07:40 2020
Fix crash and items of LazyColumn being incorrectly drawn
If the child LayoutNode was not placed its layers invalidation is still scheduled and we ended up drawing not measured node or just drawing the incorrect state of the node. And then we didn't redraw it correctly next time when the parent finally placed the node as it was already invalidated and not dirty anymore.
Test: InvalidatingNotPlacedChildTest, manually
Relnote: Fix for items of LazyColumn being incorrectly drawn sometimes, this was also causing crashes in some conditions.
Fixes: 163066980
Fixes: 165921895
Change-Id: Ibcf1745e40606f6a38d9eb90f915443935d34403
A compose/ui/ui/src/androidAndroidTest/kotlin/androidx/compose/ui/draw/InvalidatingNotPlacedChildTest.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/InnerPlaceable.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayerWrapper.kt
M compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/node/LayoutNode.kt
Description
The scrolling is laggy also.
Android Studio Build: Canary 7
Version of Gradle Plugin: 4.2.0-alpha07
Version of Gradle: 6.6-rc-3-all
Version of Java: 1.8
OS: Windows 10
Steps to Reproduce: Gist to reproduce
There is also videos for the issue on a slack thread in compose channel
The example uses AnimatedVisibility but before that i used animateContentSize and same thing happen