import React, { Component } from 'react';
import { emailRegex } from '../lib/email';
import * as t from 'tcomb-form-native';
import { SingleLineForm } from './SingleLineForm';
import { FormLabelPosition } from './Form';
const EmailType = t.refinement(t.String, (str) => {
    return emailRegex.test((str || '').trim());
});
export class EmailForm extends Component {
    constructor(props) {
        super(props);
        this.fieldsTypes = t.struct({
            email: EmailType
        });
        this.fieldsOptions = Object.assign({ email: {
                placeholder: 'Email',
                returnKeyType: 'next',
                autoCorrect: false,
                autoCapitalize: 'none',
                keyboardType: 'email-address',
                error: 'Required Field'
            } }, props.fieldsOptions);
        this.labelPosition = (typeof props.labelPosition === 'number') ?
            props.labelPosition : FormLabelPosition.Inline;
    }
    render() {
        return (<SingleLineForm {...this.props} fieldsTypes={this.fieldsTypes} fieldsOptions={this.fieldsOptions} labelPosition={this.labelPosition}/>);
    }
}
//# sourceMappingURL=EmailForm.js.map