TypeError: Cannot read property 'uid' of null
import { Pressable, Text, TextInput, View, Image, TouchableOpacity, Modal } from 'react-native';
import { gStyle } from '../styles/style';
import { Feather } from '@expo/vector-icons';
import React, { useState, useEffect } from 'react';
import { useNavigation } from '@react-navigation/native';
import { firebase } from '../Firebase/firebase';
import 'firebase/compat/auth';
import 'firebase/compat/database';
import 'firebase/compat/firestore';

export default function Header() {
    
    const [userAuthenticated, setUserAuthenticated] = useState(false);

    const [isModalVisible, setIsModalVisible] = useState(false);

    const showModal = () => {
    setIsModalVisible(true);
    };

    const hideModal = () => {
    setIsModalVisible(false);
    };
    
    const navigation = useNavigation();

    useEffect(() => {
        const unsubscribe = firebase.auth().onAuthStateChanged(user => {
        if (user) {
        setUserAuthenticated(true);
        } else {
        setUserAuthenticated(false);
        }
        });
        
        return unsubscribe;
        }, []);
    return (
            <View style={gStyle.main}>
                <View style={gStyle.headerContainer}>
                    <Image
                    source={require('../assets/logo.png')}
                    style={gStyle.logoImg}
                    />
                    <View style={gStyle.menu}>
                        <TouchableOpacity onPress={showModal}>
                            <Text style={gStyle.menuRedLine}></Text>
                            <Text style={gStyle.menuRedLine}></Text>
                            <Text style={gStyle.menuRedLine}></Text>
                            <Modal visible={isModalVisible} animationType='fade' transparent={true}>
                                <View style={gStyle.modal}>
                                    <TouchableOpacity onPress={hideModal}>
                                        <Text style={gStyle.close}>Х</Text>
                                    </TouchableOpacity>
                                    <TouchableOpacity 
                                    onPress={()=>navigation.navigate('Home')}
                                    >
                                        <Text style={gStyle.menuItem}>Главная</Text>
                                    </TouchableOpacity>
                                    <TouchableOpacity 
                                    onPress={()=>navigation.navigate('AllFutureMK')}
                                    >
                                        <Text style={gStyle.menuItem}>Будущие мастер-классы</Text>
                                    </TouchableOpacity>
                                    <TouchableOpacity 
                                    onPress={()=>navigation.navigate('AllPastMK')}
                                    >
                                        <Text style={gStyle.menuItem}>Архив мастер-классов</Text>
                                    </TouchableOpacity>
                                    <TouchableOpacity 
                                    onPress={()=>navigation.navigate('FormAddMK')}
                                    >
                                        
                                        <Text style={gStyle.menuItem}>Добавить мастер-класс</Text>
                                    </TouchableOpacity>
                                    {userAuthenticated ?
                                    <TouchableOpacity 
                                    onPress={()=>navigation.navigate('Profile')}
                                    >
                                        <Text style={gStyle.menuItem}>Личный кабинет</Text>
                                    </TouchableOpacity>
                                    :
                                    <TouchableOpacity 
                                    onPress={()=>navigation.navigate('Auth')}
                                    >
                                        <Text style={gStyle.menuItem}>Личный кабинет</Text>
                                    </TouchableOpacity>
                                    }
                                </View>
                            </Modal>
                        </TouchableOpacity>
                    </View>
                </View>
                    <View style={gStyle.searchBox}>
                        <TextInput style={gStyle.search} placeholder="Поиск" />
                            <View style={gStyle.boxBtn}>
                                <Pressable style={gStyle.searchBtn}>
                                    <Feather name="search" size={25} color="white" />
                                </Pressable>
                            </View>
                    </View>
            </View>
    );
  }


import { Text, View, TextInput, Pressable, ScrollView, Alert, TouchableHighlight, TouchableOpacity } from 'react-native';
import { gStyle } from '../styles/style';
import Header from '../components/Header';
import Footer from '../components/Footer';
import { useNavigation } from '@react-navigation/native';
import { firebase } from '../Firebase/firebase';
import 'firebase/compat/auth';
import 'firebase/compat/database';
import 'firebase/compat/firestore';
import React, {useState} from 'react';

export default function Auth() {
    const navigation = useNavigation();
    const [email, setEmail] = useState('');
    const [password, setPassword] = useState('');
    const handleLogin = () => {
        firebase.auth().signInWithEmailAndPassword(email, password)
        .then((userCredential) => {
        const user = userCredential.user;
        console.log('Пользователь вошел:', user.email);
        })
        .catch((error) => {
        const errorMessage = error.message;
        console.log(errorMessage);
        Alert.alert('Ошибка!', errorMessage);
        });
        };
  return (
    <View>
        <ScrollView>
            <Header/>
    <View style={gStyle.main}>
        
        <Text style={gStyle.header}>Войти в личный{"\n"}кабинет</Text>
        <View style={gStyle.AuthContainer}>
            <View style={gStyle.AuthBox}>
                <View style={gStyle.AuthBox1}>
                    <Text style={gStyle.AuthName}>Почта</Text>
                    <TextInput style={gStyle.AuthInfo}
                    onChangeText={setEmail}
                    />
                </View>
                <View style={gStyle.AuthBox1}>
                    <Text style={gStyle.AuthName}>Пароль</Text>
                    <TextInput style={gStyle.AuthInfo}
                    onChange={setPassword}
                    secureTextEntry={true}
                    />
                </View>
            </View>
            <Pressable style={gStyle.AuthForgotPassword} onPress={''}>
                <Text style={gStyle.AuthPass}>Забыли пароль?</Text>
            </Pressable>
            <TouchableOpacity style={gStyle.AuthLogin} onPress={handleLogin}>
                <Text style={gStyle.AuthBtnLogin}>Войти</Text>
            </TouchableOpacity>
            <Pressable 
            onPress={()=>navigation.navigate('Registration')}
            >
                <Text style={gStyle.AuthRegistr}>Я не зарегистрирован(а)</Text>
            </Pressable>
        </View>
        </View>
        <Footer/>
        </ScrollView>
    </View>
  );
}

whats wrong?