Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import React, { Component } from 'react';
- import PropTypes from 'prop-types';
- import { StatusBar } from 'react-native';
- import api from '../../services/api';
- import { StackActions, NavigationActions } from 'react-navigation';
- import {
- Container,
- Logo,
- SuccessMessage,
- Input,
- ErrorMessage,
- Button,
- ButtonText,
- SignInLink,
- SignInLinkText,
- } from './styles';
- export default class SignUp extends Component {
- static navigationOptions = {
- header: null,
- };
- static propTypes = {
- navigation: PropTypes.shape({
- navigate: PropTypes.func,
- dispatch: PropTypes.func,
- goBack: PropTypes.func,
- }).isRequired,
- };
- state = {
- username: '',
- email: '',
- password: '',
- error: '',
- success: '',
- };
- render() {
- return (
- <Container>
- <StatusBar hidden />
- <Logo source={require('../../images/airbnb_logo.png')} resizeMode="contain" />
- {this.state.success.length !== 0 && <SuccessMessage>{this.state.success}</SuccessMessage>}
- <Input
- placeholder="Nome de usuário"
- value={this.state.username}
- onChangeText={this.handleUsernameChange}
- autoCapitalize="none"
- autoCorrect={false}
- />
- <Input
- placeholder="Endereço de e-mail"
- value={this.state.email}
- onChangeText={this.handleEmailChange}
- autoCapitalize="none"
- autoCorrect={false}
- />
- <Input
- placeholder="Senha"
- value={this.state.password}
- onChangeText={this.handlePasswordChange}
- autoCapitalize="none"
- autoCorrect={false}
- secureTextEntry
- />
- {this.state.error.length !== 0 && <ErrorMessage>{this.state.error}</ErrorMessage>}
- <Button onPress={this.handleSignUpPress}>
- <ButtonText>Criar conta</ButtonText>
- </Button>
- <SignInLink onPress={this.handleBackToLoginPress}>
- <SignInLinkText>Voltar ao login</SignInLinkText>
- </SignInLink>
- </Container>
- );
- }
- }
Add Comment
Please, Sign In to add comment