Open robertlevonyan opened 2 years ago
Which Compose version is this?
Haven't been able to repro on 1.0.0 or even 1.1.0.
I'm using a very simple setup:
@OptIn(ExperimentalMotionApi::class)
@Preview
@Composable
fun CrashTest() {
var sectionsState: Boolean by rememberSaveable { mutableStateOf(false) }
val collapsedSet = getCollapsedConstraints()
val expandedSet = getExpandedConstraints()
val progress by animateFloatAsState(
targetValue = if (sectionsState) 1f else 0f,
animationSpec = tween(150)
)
Column {
MotionLayout(
start = collapsedSet,
end = expandedSet,
progress = progress,
modifier = Modifier.fillMaxWidth().weight(1.0f, true),
) {
Text(
text = "My Title",
Modifier
.layoutId("title")
.background(Color.Red))
Text(
text = "My subtitle",
Modifier
.layoutId("subtitle")
.background(Color.Blue))
Text(
text = "TOGGLE",
Modifier
.layoutId("toggle")
.background(Color.Cyan))
Text(
text = "Sections",
Modifier
.layoutId("sections")
.background(Color.Yellow))
Text(
text = "Timers:",
Modifier
.layoutId("timers")
.background(Color.Gray))
}
Button(onClick = { sectionsState = !sectionsState }) {
Text(text = "Run")
}
}
}
Any chance one of the Composables in MotionLayout has a size Modifier? (size, sizeIn, defaultMin, fillMaxSize, etc)
Does it still crash with Dimension.fillToConstraints instead of Dimension.matchParent?
Here is an example that shows the same error message, https://github.com/jipariz/ComposeMotion from the article, https://www.strv.com/blog/collapsing-toolbar-using-jetpack-compose-motion-layout-engineering.
Based on this ComposeMotion project, update the followings: 1) compose_version = '1.1.1' 2) classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.6.10" 3) distributionUrl=https\://services.gradle.org/distributions/gradle-7.3-bin.zip
Then compile and run. The exact same code works on older Compose versions, 1.0.1 and 1.04. However, it doesn't work with 1.1.1 with the error message. Thanks.
Also had this issue today using the repo @Eric-Cen linked. @oscar-ad do you know if there's any workaround for this?
No workaround other than sticking to 1.0.x
It's a hard check that prevents us from remeasuring Composables during animation in some cases.
I'll close this once we work out a solution with the rest of the Compose team.
Issue seems to be resolved when using 1.2.0-alpha08 Tho I see issues with custom properties.
I'll keep this open until 1.2.0 hits stable or I'm able to guarantee no regressions from there.
The motion layout is crashing with this error.
this is my code