onBindViewWithValue

inline fun <T> Style.onBindViewWithValue(noinline name: () -> String, value: Value<T>, defaultValue: T, crossinline func: View.(T) -> Unit): Style

This Style adds a mount callback for state value.

When the Component is mounted, func is invoked with the View as the receiver and the current value from value. The state read is tracked to enable automatic re-rendering when the tracked state changes.

When the Component is unmounted, func is invoked with defaultValue to reset the view state.

Parameters

name

a description for the binder, used for debugging purposes.

value

the Value whose reads will be tracked during the bind operation.

defaultValue

the value to apply when unbinding to reset the view state.

func

the function applied to the view with the current or default value.