import { Text, View, Pressable, TextInput, Alert, ScrollView} from ‘react-native’;
import Header from ‘…/components/Header’;
import Footer from ‘…/components/Footer’;
import { gStyle } from ‘…/styles/style’;
import React, {useState} from ‘react’;
import { firebase } from ‘…/Firebase/firebase’;
import ‘firebase/compat/auth’;
import ‘firebase/compat/database’;
import ‘firebase/compat/firestore’;


export default function Registration() {
const [name, setName] = useState(‘’);
const [surname, setSurname]=useState(‘’);
const [email, setEmail] = useState(‘’);
const [phone, setPhone] = useState(‘’);
const [password, setPassword] = useState(‘’);
const [confirmPassword, setConfirmPassword]=useState(‘’);
const handleRegistration=()=>{
if(
name===‘’||
surname===‘’||
email===‘’||
phone===‘’||
password===‘’||
confirmPassword===‘’
){
Alert.alert(‘Ошибка!’,‘Пожалуйста, заполните все поля для регистрации’);
}
if(password!==confirmPassword){
Alert.alert(‘Ошибка!’,‘Пароли не совпадают’);
return;
}
firebase.auth()
.createUserWithEmailAndPassword(email, password)
.then((result)=>{
const userDetails={
name,
surname,
email,
phone,
};
firebase.database().ref(users/${result.user.uid}).set(userDetails);
})
}
return (
<View>
<ScrollView>
<Header/>
<View style={gStyle.main}>
<Text style={gStyle.header}>Зарегистрироваться</Text>
<Text style={gStyle.RegLine}></Text>
<View style={gStyle.RegContainer}>
<View style={gStyle.RegBox}>
<Text style={gStyle.RegName}>Имя</Text>
<TextInput style={gStyle.RegInfo}
onChangeText={text => setName(text)}/>
</View>
<View style={gStyle.RegBox}>
<Text style={gStyle.RegName}>Фамилия</Text>
<TextInput style={gStyle.RegInfo}
onChangeText={text => setSurname(text)}/>
</View>
<View style={gStyle.RegBox}>
<Text style={gStyle.RegName}>Электронная почта</Text>
<TextInput style={gStyle.RegInfo}
onChangeText={text => setEmail(text)}/>
</View>
<View style={gStyle.RegBox}>
<Text style={gStyle.RegName}>Номер телефона</Text>
<TextInput style={gStyle.RegInfo}
onChangeText={text => setPhone(text)}/>
</View>
<View style={gStyle.RegBox}>
<Text style={gStyle.RegName}>Пароль</Text>
<TextInput style={gStyle.RegInfo}
onChangeText={text => setPassword(text)}
secureTextEntry={true}/>
</View>
<View style={gStyle.RegBox}>
<Text style={gStyle.RegName}>Подтверждение пароля</Text>
<TextInput style={gStyle.RegInfo}
onChangeText={text => setConfirmPassword(text)}
secureTextEntry={true}/>
</View>
</View>
<Pressable style={gStyle.RegRegistrBtn}
onPress={handleRegistration}
>
<Text style={gStyle.RegRegistration}>Зарегистрироваться</Text>
</Pressable>
<Text style={gStyle.RegConf}>Нажимая на кнопку, Вы соглашаетесь с{‘\n’}Политикой конфиденциальности</Text>
<Text style={gStyle.RegLine}></Text>
</View>
<Footer/>
</ScrollView>
</View>
);
};
thats my registr file
import { Text, View, TextInput, Pressable, ScrollView, Alert } 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 [phone, setPhone] = useState(‘’);
const [password, setPassword] = useState(‘’);
const [errorMessage, setErrorMessage] = React.useState(null);
const handleLogin=()=>{
if (!email || !password) {
Alert.alert(‘Ошибка!’,‘Неверная почта или пароль’);
return;
}
firebase.auth().signInWithEmailAndPassword(email, password)
.then(()=>{
navigation.navigate(‘Profile’);
})
.catch((error)=>{
setErrorMessage(error.message);
console.log(error);
})
}
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>
<Pressable style={gStyle.AuthLogin} onPress={handleLogin}>
<Text style={gStyle.AuthBtnLogin}>Войти</Text>
</Pressable>
<Pressable
onPress={()=>navigation.navigate(‘Registration’)}
>
<Text style={gStyle.AuthRegistr}>Я не зарегистрирован(а)</Text>
</Pressable>
</View>
</View>
<Footer/>
</ScrollView>
</View>
);
}

thats my auth file
import { Text, View, Image, ScrollView, Pressable } from ‘react-native’;
import Header from ‘…/components/Header’;
import Footer from ‘…/components/Footer’;
import { gStyle } from ‘…/styles/style’;
import { firebase } from ‘…/Firebase/firebase’;
import ‘firebase/compat/auth’;
import ‘firebase/compat/database’;
import ‘firebase/compat/firestore’;
import React, {useState, useEffect} from ‘react’;



export default function Profile() {
useEffect(() => {
const currentUserID = firebase.auth().currentUser.uid;

firebase
.database()
.ref(‘users/’ + currentUserID)
.once(‘value’)
.then((snapshot) => {
const data = snapshot.val();
setUserData(data);
});
}, []);
const [userData, setUserData] = useState(null);
return (
<View>
<ScrollView>
<Header/>
<View style={gStyle.main}>
<View style={gStyle.ProfileBox}>
<View style={gStyle.ProfileGreeting}>
<Text style={gStyle.ProfileName}>Анастасия</Text>
<Text style={gStyle.ProfileHello}>Добро пожаловать в{‘\n’}личный кабинет</Text>
</View>
<View style={gStyle.ProfileBlock}>
<View style={gStyle.ProfileChain}>
<Text style={gStyle.ProfileTitle}>Имя</Text>
<View style={gStyle.ProfileInfo}>
<Text style={gStyle.ProfileValue}>Анастасия</Text>
</View>
</View>
<View style={gStyle.ProfileChain}>
<Text style={gStyle.ProfileTitle}>Фамилия</Text>
<View style={gStyle.ProfileInfo}>
<Text style={gStyle.ProfileValue}>Анастасьева</Text>
</View>
</View>
<View style={gStyle.ProfileChain}>
<Text style={gStyle.ProfileTitle}>Электронная почта</Text>
<View style={gStyle.ProfileInfo}>
<Text style={gStyle.ProfileValue}><PRESIDIO_ANONYMIZED_EMAIL_ADDRESS></Text>
</View>
</View>
<View style={gStyle.ProfileChain}>
<Text style={gStyle.ProfileTitle}>Номер телефона</Text>
<View style={gStyle.ProfileInfo}>
<Text style={gStyle.ProfileValue}>+7(999)-999-99-99</Text>
</View>
</View>
<Pressable>
<Text>Выйти</Text>
</Pressable>
</View>
</View>
<View style={gStyle.ProfilePaidMK}>
<Text style={gStyle.ProfilePaid}>Забронированные{‘\n’}мастер-классы</Text>
<Text style={gStyle.ProfileLine}></Text>
<View style={gStyle.ProfileDetails}>
<Image source={require(‘…/assets/example.jpeg’)} style={gStyle.ProfileImg}/>
<View style={gStyle.ProfileDescription}>
<Text style={gStyle.ProfileTitleOfMK}>Мастер-класс №1</Text>
<Text style={gStyle.ProfileDate}>Время 12:00 12/12/2012</Text>
<Text style={gStyle.ProfilePrice}>Цена: 350 Р.</Text>
</View>
</View>
<Text style={gStyle.ProfileLine}></Text>
</View>
</View>
<Footer/>
</ScrollView>
</View>

);
}

thats profile
How to do that user can see his info (name, surname, email, phone)?