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

this.validate is undefined

Open hassanrazakhalid opened this issue 8 years ago • 7 comments

Hello i have just started using this. However i cann't perform simple validation simulator screen shot - iphone 7 - 2017-11-04 at 16 48 34

I have extended from ValidationComponent. Any idea what i might be doing wrong

export default class LoginComponent extends ValidationComponent {

    static navigationOptions = { title: 'Login Screen' };

    constructor(props) {
        super(props);

        this.state = {
            userName: '',
            password: '',
            // navigation :this.props.navigation,
        };

 loginTapped() {
        this.validate({
            userName: { required: true },
            password: { email: true }
        });

hassanrazakhalid avatar Nov 04 '17 12:11 hassanrazakhalid

Hi @hassanrazakhalid, check if node_modules/react-native-form-validator it is installed, after the import => import ValidationComponent from 'react-native-form-validator';

fcostaprojects avatar Nov 07 '17 15:11 fcostaprojects

Exact same issue here. Using Expo 23, react 16 Everything installed and being imported

pancastro avatar Dec 10 '17 16:12 pancastro

I have the same issue, did you found any solution plz ?

ayoubben avatar Jan 11 '18 15:01 ayoubben

i have the same issue can any one found solution?

aslampatel avatar Mar 08 '18 09:03 aslampatel

add this.loginTapped = this.loginTapped.bind(this); in constructor.. like this constructor(props) { super(props);

    this.state = {
        userName: '',
        password: '',
        // navigation :this.props.navigation,
    };
   this.loginTapped = this.loginTapped.bind(this);

}

kirtiraj-patil avatar Mar 25 '18 18:03 kirtiraj-patil

Facing same issue, any solution for this?

rbissa avatar Oct 21 '19 09:10 rbissa

Use this

_onPressButton = () => {
this.validate({
name: { minlength: 3, maxlength: 7, required: true },
email: { email: true },
number: { numbers: true },
date: { date: 'YYYY-MM-DD' }
});
}

Instead of

_onPressButton(){
this.validate({
name: { minlength: 3, maxlength: 7, required: true },
email: { email: true },
number: { numbers: true },
date: { date: 'YYYY-MM-DD' }
});
}

renerlemes avatar Jan 31 '20 23:01 renerlemes