Advertisement
Guest User

Untitled

a guest
Dec 12th, 2019
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { useState } from 'react';
  2. import { View, TouchableOpacity, Text, Alert, ScrollView, TextInput } from 'react-native';
  3. import { SafeAreaView, Button } from '../../components';
  4. import * as Labels from '../../utils/Labels';
  5. import styles from './LoginScreen.styles';
  6.  
  7. const LoginScreen = ({ navigation }) => {
  8.     console.log(navigation);
  9.     const [ loading, setLoading ] = useState(false);
  10.     const [ email, setEmail ] = useState('');
  11.     const [ password, setPassword ] = useState('');
  12.    
  13.  
  14.     /**
  15.    * It's function to go to Register screen
  16.    */
  17.     const onRegisterPressed = () => {
  18.         navigation.replace('Register');
  19.     };
  20.  
  21.     /**
  22.    * It's function to go to Remind screen
  23.    */
  24.     const onRemindPressed = () => {
  25.         navigation.navigate('Remind');
  26.     };
  27.  
  28.     /**
  29.    * It's function to call userLogin function
  30.    */
  31.     const onLoginPressed = () => {
  32.        
  33.     };
  34.  
  35.     /**
  36.    * It's function to call facebookLogin function
  37.    */
  38.     const onFacebookPressed = () => {
  39.        
  40.     };
  41.  
  42.     const alertErrorConnection = (id) => {
  43.         Alert.alert('Problem', 'Wystąpił problem w połączeniu z serwerem', [
  44.             {
  45.                 text: 'OK',
  46.                 onPress: () => {
  47.                     setLoading(false);
  48.                 }
  49.             }
  50.         ]);
  51.     };
  52.  
  53.     return (
  54.         <SafeAreaView style={styles.container}>
  55.             <View style={styles.title}>
  56.                 <Text style={styles.titleText}>{Labels.LOGIN_TEXT}</Text>
  57.             </View>
  58.             <View style={styles.form}>
  59.                 <TextInput
  60.                     style={styles.loginInput}
  61.                     value={email}
  62.                     onChangeText={(text) => setEmail(text)}
  63.                     placeholder={Labels.EMAIL_PLACEHOLDER}
  64.                     placeholderTextColor="#000"
  65.                     keyboardType="email-address"
  66.                 />
  67.                 <TextInput
  68.                     style={styles.loginInput}
  69.                     value={password}
  70.                     onChangeText={(text) => setPassword(text)}
  71.                     placeholder={Labels.PASSWORD_PLACEHOLDER}
  72.                     placeholderTextColor="#000"
  73.                     secureTextEntry
  74.                 />
  75.             </View>
  76.             <View>
  77.                 <Button btnStyle={styles.loginButton} textStyle={styles.loginButtonText} text={Labels.LOGIN_BUTTON_TEXT} onPress={() => navigation.navigate('ProfileSelect')} />
  78.                 <Button btnStyle={styles.remindButton} textStyle={styles.remindButtonText} text={Labels.REMIND_BUTTON_TEXT} onPress={onRemindPressed} />
  79.                 <Button btnStyle={styles.registerButton} textStyle={styles.registerButtonText} text={Labels.REGISTER_BUTTON_TEXT} onPress={onRegisterPressed} />
  80.                 <Button btnStyle={styles.facebookButton} textStyle={styles.facebookButtonText} text={Labels.FACEBOOK_BUTTON_TEXT} onPress={onFacebookPressed} />
  81.             </View>
  82.         </SafeAreaView>
  83.     );
  84. };
  85.  
  86. export default LoginScreen;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement