Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The onValueChange of BasicTextField is not activated when TextFieldValue is set to an empty value in Jetpack Compose because the value has not actually changed.

When the value of the text field is set to empty, it is already considered as the default value of the field or the initial value. Therefore, no change happens in the value of the text field, which means that the onValueChange callback will not be triggered.

However, if you want to respond to an empty value and perform some action, you can use the onFocusChanged callback to check if the field is empty when it loses focus. Alternatively, you can also manually trigger the onValueChange callback when the text field is cleared using a clear button or a reset button.