Android Compose + Rive data binding: ViewModelStringProperty stops updating after pause, and Inpu...

Environment

  • Rive Android Runtime: (please fill exact version)

  • Android: (device + OS version)

  • Jetpack Compose: (version)

  • AGP / Gradle: (versions)

Summary
I integrate Rive in a Jetpack Compose screen via AndroidView + RiveAnimationView (autoBind=true).
I bind:

  • ViewModelStringProperty("txt") ← from an OutlinedTextField (real-time text)

  • ViewModelBooleanProperty("isBro") → to show/hide the input overlay

Issues

  1. Text updates reach Rive in real time only at first. If I pause typing briefly and then type again, new characters don’t reach the bound "txt" unless I toggle the keyboard.

  2. On IME Done, I set isBro=false, but sometimes the overlay/state doesn’t close immediately (seems unobserved until another repaint).

What I tried

  • After each txt.value = ..., calling controller.advance(0f) and view.invalidate() to force an update.

  • Same “poke” after setting isBro=false on IME Done.

  • Keeping windowSoftInputMode=adjustNothing and overlaying the TextField above IME.

  • Listening to isBro using valueFlow.collectAsState().

Expected

  • "txt" should update on every keystroke reliably (no need to toggle keyboard).

  • Setting isBro=false on IME Done should close the overlay in the same frame.
    Minimal repro (Kotlin/Compose)

val riveViewRef = remember { mutableStateOf<RiveAnimationView?>(null) }
val vmiRef = remember { mutableStateOf<ViewModelInstance?>(null) }

// Observe overlay toggle from Rive
val isBroFlow = remember(vmiRef.value) {
    vmiRef.value?.getBooleanProperty("isBro")?.valueFlow
}
val isBro by (isBroFlow?.collectAsState(initial = false) ?: remember { mutableStateOf(false) })

AndroidView(
    modifier = Modifier.fillMaxSize(),
    factory = { context ->
        RiveAnimationView(context).apply {
            setRiveResource(
                resId = R.raw.test,
                artboardName = "Artboard",
                fit = Fit.LAYOUT,
                alignment = app.rive.runtime.kotlin.core.Alignment.CENTER,
                autoBind = true
            )
            play()
            riveViewRef.value = this
            controller.activeArtboard?.viewModelInstance?.let { vmiRef.value = it }
            isFocusable = false; isFocusableInTouchMode = false
        }
    }
)

if (isBro) {
    var localText by remember { mutableStateOf(vmiRef.value?.getStringProperty("txt")?.value ?: "") }
    OutlinedTextField(
        value = localText,
        onValueChange = { newText ->
            localText = newText
            vmiRef.value?.getStringProperty("txt")?.value = newText
            // force update for now
            riveViewRef.value?.controller?.advance(0f)
            riveViewRef.value?.invalidate()
        },
        keyboardOptions = KeyboardOptions(imeAction = ImeAction.Done),
        keyboardActions = KeyboardActions(
            onDone = {
                vmiRef.value?.getBooleanProperty("isBro")?.value = false
                riveViewRef.value?.controller?.advance(0f)
                riveViewRef.value?.invalidate()
            }
        ),
        singleLine = true
    )
}

Questions

  1. What’s the recommended way (in Compose) to push continuous, real-time updates into a ViewModelStringProperty?
    Should we rely on advance(0f)/invalidate() after each set, or is there a preferred API/pattern when using autoBind?

  2. For closing the overlay, is setting isBro.value = false on IME Done correct?
    If yes, how can we guarantee the value change is observed in the same frame (threading/scheduling/advance guidance)?

  3. Any best practices for Compose + data binding (debounce/throttle, lifecycle, etc.) to keep updates reliable?

Thanks a lot for any pointers! 🙏