NewOldMax / react-form-validator-core

Core validator component for react forms
MIT License
95 stars 44 forks source link

isFormValid() returs Promise #45

Closed anandsingh1606 closed 5 years ago

anandsingh1606 commented 5 years ago
isFormValid dryRun: bool (default true) bool Get form validation state (true if whole form is valid). Run with dryRun = false to show validation errors on form

but i am getting return value as promise. I try to check the code and found the same https://github.com/NewOldMax/react-form-validator-core/blob/master/src/ValidatorForm.jsx#L149 -> https://github.com/NewOldMax/react-form-validator-core/blob/master/src/ValidatorForm.jsx#L69

Let me know if I am missing something.

NewOldMax commented 5 years ago

Hi yes it returns promise, I forgot to change readme, thanks for pointing

anandsingh1606 commented 5 years ago

after a bit more debug i found that its been changed in latest releases. the example you have in other issue is using 0.5.1 and that has


 walk = (children, dryRun) => {
        const self = this;
        let result = true;
        if (Array.isArray(children)) {
            children.forEach((input) => {
                if (!self.checkInput(input, dryRun)) {
                    result = false;
                }
                return input;
            });
        } else {
            result = self.walk([children], dryRun);
        }
        return result;
    }