react-native-form-validator icon indicating copy to clipboard operation
react-native-form-validator copied to clipboard

validate nested this.state

Open kennicefung opened this issue 6 years ago • 2 comments

This version has added iteration for looking into the children of this.state, so that we can validate nested this.state. For example, say we have: this.state={ data:{ email:'' } }

In terms of the usage: this.validate({ data:{ email: { email: true, required: true } } })

For rendering error, we could use "data.email": {this.isFieldInError('data.email') && this.getErrorsInField('data.email').map(errorMessage => <Text>{errorMessage}</Text>) }

kennicefung avatar Nov 02 '19 17:11 kennicefung

@perscrew is it worth using above PR ? If Yes Please merge it

anshulchauhan70 avatar Mar 04 '22 12:03 anshulchauhan70

@perscrew is it worth using above PR ? If Yes Please merge it

This library has been completely rewritten in typescript. I prefer to work on https://github.com/perscrew/react-simple-form-validator and start a new PR.

perscrew avatar Mar 04 '22 13:03 perscrew