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

this.validate is not a function" in TypeError: this.validate is not a function << at ...

Open asdf23 opened this issue 5 years ago • 2 comments

Perhaps I'm not getting something, nothing in this package seems to work at all.

this.validate is not a function" in TypeError: this.validate is not a function << at _onSubmit
  _onSubmit() {
      this.validate({
        emailField: {email: true, required: true},
        passwordField: {required: true}
      });
  }
...
          <TextInput
            ref="emailField"   deviceLocale="fr"
            style={AppStyles.input}
            keyboardType="email-address"
            placeholder="Email Address"
            onChangeText={(emailField) => this.setState({emailField})} value={this.state.emailField} 
          />

asdf23 avatar Nov 13 '20 00:11 asdf23

Can you provide all your file ?

arochedy avatar Nov 13 '20 11:11 arochedy

import ValidationComponent from 'react-native-form-validator'; // you need to import class RegisterScreen extends ValidationComponent {} // make sure you change the component to ValidationComponent

 _onSubmit() {
      this.validate({
        emailField: {email: true, required: true},
        passwordField: {required: true}
      });
  }

WILL WORK FINE @arochedy @asdf23 @solved

razavistag avatar Apr 21 '21 21:04 razavistag