androidx / constraintlayout

ConstraintLayout is an Android layout component which allows you to position and size widgets in a flexible way
Apache License 2.0
1.06k stars 177 forks source link

App crashes when trying to animate fontSize in MotionScene for Compose #853

Open David8aO opened 3 months ago

David8aO commented 3 months ago

I'm using version 1.0.1 of Motion Layout for Jetpack Compose alongside with compose bom 2024.02.01, material3 and a JSON5 motion scene, and when i try to do a simple use case such animating Text() font size, the app crashes with the next error message:

java.lang.IllegalArgumentException: no paragraph androidx.compose.foundation.text.modifiers.TextStringSimpleNode.draw(TextStringSimpleNode.kt:390)

I followed the example in: https://github.com/androidx/constraintlayout/wiki/Compose-MotionLayout-JSON-Syntax

custom: { background: '#0000FF', textColor: '#FFFFFF', textSize: 12 }

var properties = motionProperties("a") Text(text = "Hello", modifier = Modifier .layoutId(properties.value.id()) .background(properties.value.color("background")) ,color = properties.value.color("textColor") ,fontSize = properties.value.fontSize("textSize") )

I think it has something to do with the implementation of the new Modifier.Node() method for Text composables drawing/rendering