Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
David8aO opened this issue Mar 4, 2024 · 2 comments
Open
Labels
bug Something isn't working

Comments

@David8aO
Copy link

David8aO commented Mar 4, 2024

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

@David8aO David8aO added the bug Something isn't working label Mar 4, 2024
@akimaleo
Copy link

I face the same issue. It works fine with color, but fails wiith fontSize of fontWeight.
I was trying two more things which failed:

  • Animate it using linear interpolation in Compose
  • Use float istead of text unit.

@spanthangi-aligntech
Copy link

@David8aO - Have you addressed this crash, can you please add some suggestions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants