Skip to content

Undefined is not a function (evaluating '(0, _reactNativeFormValidator.Validate)') #16019

@AAGSICON

Description

@AAGSICON

screenshot_2017-09-20-08-33-19-48

import React, { Component } from 'react';
import { NativeModules } from 'react-native';
import DatePicker from 'react-native-datepicker'
import ValidationComponent, {validate} from 'react-native-form-validator';
import { Text, TextInput, View, Button, Form, NativeAppEventEmitter, Camera, Alert } from 'react-native';

export default class Registration extends Component {

constructor(props) {
super(props);
this.state = {text: '', date:""};
}
_onPressButton() {
// Call ValidationComponent validate method
validate({
Username: {minlength:3, maxlength:7, required: true},
email: {email: true},
lastName: {required: true},

});
}

render() {
return (
<View style={{padding: 30}}>
<TextInput

        Name="firstName"
         style={{height: 40}}
          autoFocus={true}
          autoCapitalize="none"
          autoCorrect={false}
          placeholder="First Name"
          onChangeText={(firstName) => this.setState({firstName})}
        />

      <TextInput
      Name="lastName"
       style={{height: 40}}
        autoFocus={false}
        autoCapitalize="none"
        autoCorrect={false}
        placeholder="Last Name"
        onChangeText={(lastName) => this.setState({lastName})}
      />
      <DatePicker
        style={{width: 800}}
        date={this.state.date}
        mode="date"
        placeholder="Select Date of Birth"
        format="YYYY-MM-DD"
        confirmBtnText="Confirm"
        cancelBtnText="Cancel"
        customStyles={{
          dateIcon: {
            position: 'absolute',
            left: 0,
            top: 4,
            marginLeft: 0
          },
          dateInput: {
            marginLeft: 36
          }
      // ... You can check the source to find the other keys.
    }}
    onDateChange={(date) => {this.setState({date: date})}}
  />
      <TextInput
      Name="email"
       style={{height: 40}}
       autoFocus={false}
       autoCapitalize="none"
       autoCorrect={false}
       placeholder="Email"
       onChangeText={(email) => this.setState({email})}
     />

      <TextInput
      Name="Username"
      style={{height: 40}}
      placeholder="Username!"
      onChangeText={(text) => this.setState({text})}
    />

       <TextInput
     Name="password"
      style={{height: 40}}
      placeholder="password!"
      secureTextEntry={true}
      autoCapitalize="none"
      autoCorrect={false}
      onChangeText={(text) => this.setState({text})}
    />

      <TextInput
      Name="passwordConfirmation"
       style={{height: 40}}
        secureTextEntry={true}
        autoCapitalize="none"
        autoCorrect={false}
        placeholder="Password Confirmation"
        onChangeText={(passwordConfirmation) => this.setState({passwordConfirmation})}
      />

   <Button
onPress={this._onPressButton}
 title="Press Me"

/>

    );
}

}

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions