perscrew / react-native-form-validator

React native library to validate form fields
127 stars 55 forks source link

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

Open asdf23 opened 4 years ago

asdf23 commented 4 years ago

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} 
          />
arochedy commented 4 years ago

Can you provide all your file ?

razavistag commented 3 years ago

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