Skip to content

Doesn't work correctly with TextInputLayout #2

@Barcaman94

Description

@Barcaman94

Please add one more line for TextInputLayout so that it works fine:

isErrorEnabled = false

The error lies in the fact that after swelling from the bottom of the input to display the message, and then when we want to clear the error, the error zone remains

Снимок экрана 2021-10-06 в 23 45 41

/**
     * Apply Validation
     *
     * @return List<ValidationError> UI widget on which validation failed
     */
    private fun applyValidation(): List<ValidationError> {
        val errors = ArrayList<ValidationError>()
        for (field in mValidationFields) {
            val text = getText(field.key)
            var status = true
            for (rule in field.value) {
                if (!rule.validate(text)) {
                    errors.add(ValidationError(field.key, rule.getError(field.key.context)))
                    status = false
                    break
                }
            }

            //Set Error
            if (status) setError(field.key, null)                       **<------- HERE**
        }
        setErrors(errors)
        return errors
    } 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions