var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
import React from 'react';
import { View } from 'react-native';
import { CrossButton, Colors, } from 'react-native-cross-components';
import styles from '../../styles';
import { CrossEditor } from 'react-native-cross-components';
/**
 * Allows the user to ender credentials and passes them back through prop events.
 *
 * Props are {@link IPasswordFormProps}
 *
 * @example
 *  <PasswordForm
 *      onSavePress={(code) => console.log('Confirmed', code)}
 *      saveButtonProps={{title: 'Enlist'}}
 *      codeInputProps={{label: 'WouldntYouLikeToKnow'}}>
 *     <Text>Custom layouts here</Text>
 *  </PasswordForm>
 */
export class PasswordForm extends React.Component {
    render() {
        return (React.createElement(View, { style: [styles.container], testID: this.props.testID },
            this.props.children,
            ' ',
            React.createElement(CrossEditor, Object.assign({ label: 'E-mail', placeholder: 'E-mail', autoCapitalize: 'none', clearButtonMode: 'always', autoCorrect: false, value: this.props.initialEmail || '', onChangeText: (text) => this.props.onEmailChanged(text) }, this.props.emailInputProps)),
            React.createElement(CrossEditor, Object.assign({ label: 'Confirmation code', placeholder: 'Enter the code that was sent to you', autoCapitalize: 'none', clearButtonMode: 'always', autoCorrect: false, value: this.props.code || '', onChangeText: this.props.onCodeChanged }, this.props.codeInputProps)),
            React.createElement(CrossEditor, Object.assign({ label: 'New Password', clearButtonMode: 'always', secureTextEntry: true, value: this.props.initialPassword || '', onChangeText: (text) => this.props.onPasswordChanged(text) }, this.props.passwordInputProps)),
            React.createElement(CrossButton, Object.assign({ style: styles.marginTop10, buttonStyle: styles.buttonStyle, onPress: () => __awaiter(this, void 0, void 0, function* () { return yield this.props.onSavePress(); }), mode: 'contained', title: 'Save', backgroundColor: Colors.NextButton, iconName: 'sign-in' }, this.props.saveButtonProps))));
    }
}
export default PasswordForm;
//# sourceMappingURL=PasswordForm.js.map