How to achieve real-time text input with Rive Data Binding in Jetpack Compose?
Hello,
I'm trying to bind a Jetpack Compose TextField to a Rive String property for real-time updates.
However, my current approach causes significant input lag. The UI seems to wait for a full data round-trip to Rive for every character, which makes typing feel very slow.
Is there a better way to implement this? Here's my current code:
// Problem: The UI waits for Rive to respond, causing input lag.
val textFromRive by vmiRef.value?.getStringProperty("txt")
?.valueFlow?.collectAsState(initial = "")
OutlinedTextField(
value = textFromRive,
onValueChange = { newText ->
// This causes a delay because the UI must wait for the round-trip.
vmiRef.value?.getStringProperty("txt")?.value = newText
},
// ...
)My Question
What is the recommended pattern or best practice to solve this input lag? How can I make the TextField in Jetpack Compose feel instant for the user while ensuring the Rive animation is still updated in real-time?
Thank you in advance for any help or guidance!
test.rev