Login.js 1.08 KB
import React, {useState, useContext, useEffect, useCallback} from 'react';
import {View, Text, Button, TextInput, TouchableOpacity} from 'react-native';
import {useDispatch, useSelector} from "react-redux";
import {LOG_IN_REQUEST, LOG_OUT_REQUEST} from "../reducers/user";
import {MaterialCommunityIcons} from "@expo/vector-icons";
import styled from "styled-components";
import {useNavigation} from '@react-navigation/native';
import LoadingComponent from "../components/LoadingComponent";
import MyProfileComponent from "../components/MyProfileComponent";
import LoginComponent from "../components/LoginComponent";

const Login = () => {
    const navigation = useNavigation();
    const [loading, setLoading] = useState(true);

    const {me} = useSelector(state => state.user);
    const {isLoggingIn} = useSelector(state => state.user);


    useEffect(() => {
        setLoading(false);
    }, [me]);

    return (
        <View>
            {me ?
                <MyProfileComponent/>
                :
                <LoginComponent/>
            }
        </View>
    )
};

export default Login;