Advertisement
Guest User

Untitled

a guest
Jan 19th, 2019
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react'
  2. import PropTypes from 'prop-types'
  3. import { View, ImageBackground, Image } from 'react-native'
  4.  
  5. import LocalizedText from '../../components/LocalizedText'
  6. import Input from '../../components/Input'
  7. import PasswordField from '../../components/PasswordField'
  8. import Button from '../../components/Button'
  9. import Container from '../../components/Container'
  10. import { t } from '../../services/Localization'
  11. import styles from './style'
  12.  
  13. const background = require('../../../assets/images/background.png')
  14. const volteeLogo = require('../../../assets/images/logo/volteeLogo2.png')
  15.  
  16. class LoginView extends Component {
  17.   render() {
  18.     const {
  19.       handleInputChange,
  20.       handleLogin,
  21.       handleForgotPassword,
  22.       handleFacebookLogin,
  23.       handleFocus,
  24.       email,
  25.       password,
  26.       errorMessage,
  27.       user: { isAuthenticating },
  28.     } = this.props
  29.     return (
  30.       <ImageBackground style={styles.backgroundContainer} source={background}>
  31.         <Container keyboardAvoidingView backgroundColor="transparent">
  32.           <View style={styles.loginContainer}>
  33.             <View style={styles.logo}>
  34.               <Image source={volteeLogo} />
  35.             </View>
  36.             <Button
  37.               onPress={handleFacebookLogin}
  38.               text="login.facebookLoginButton"
  39.               type="facebook"
  40.             />
  41.             <LocalizedText style={styles.or} text="login.or" upperCase />
  42.             <Input
  43.               customStyle={styles.inputPadding}
  44.               onChangeText={text => handleInputChange('email', text)}
  45.               error={errorMessage}
  46.               errorMessage={errorMessage}
  47.               onFocus={handleFocus}
  48.               value={email}
  49.               autoCapitalize="none"
  50.               keyboardType="email-address"
  51.               placeholder={t('login.emailPlaceholder')}
  52.             />
  53.             <PasswordField
  54.               customStyle={styles.inputPadding}
  55.               error={errorMessage}
  56.               errorMessage={errorMessage}
  57.               onChangeText={text => handleInputChange('password', text)}
  58.               onFocus={handleFocus}
  59.               value={password}
  60.               placeholder={t('login.passwordPlaceholder')}
  61.               secureTextEntry
  62.             />
  63.             <Button
  64.               loading={isAuthenticating}
  65.               onPress={handleLogin}
  66.               text="login.loginButton"
  67.               type="primary"
  68.             />
  69.             <LocalizedText
  70.               style={styles.forgotPasswordButton}
  71.               onPress={handleForgotPassword}
  72.               text="login.forgotPassword"
  73.             />
  74.           </View>
  75.         </Container>
  76.       </ImageBackground>
  77.     )
  78.   }
  79. }
  80.  
  81. LoginView.propTypes = {
  82.   handleInputChange: PropTypes.func.isRequired,
  83.   handleLogin: PropTypes.func.isRequired,
  84.   handleForgotPassword: PropTypes.func.isRequired,
  85.   handleFacebookLogin: PropTypes.func.isRequired,
  86.   handleFocus: PropTypes.func.isRequired,
  87.   errorMessage: PropTypes.string,
  88.   email: PropTypes.string,
  89.   password: PropTypes.string,
  90.   user: PropTypes.instanceOf(Object),
  91. }
  92.  
  93. export default LoginView
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement