Implement login functionality and create profile screen with secure storage
This commit is contained in:
76
app/profile.tsx
Normal file
76
app/profile.tsx
Normal file
@@ -0,0 +1,76 @@
|
||||
import * as SecureStore from 'expo-secure-store';
|
||||
import React, { useEffect, useState } from "react";
|
||||
import { StyleSheet, Text, View } from "react-native";
|
||||
|
||||
const PRIMARY = '#A24BFA';
|
||||
const BG = '#0c0a0a';
|
||||
|
||||
export default function Profile() {
|
||||
const [fullName, setFullName] = useState('');
|
||||
const [email, setEmail] = useState('');
|
||||
const [userId, setUserId] = useState('');
|
||||
|
||||
useEffect(() => {
|
||||
(async () => {
|
||||
const name = await SecureStore.getItemAsync('fullName');
|
||||
const mail = await SecureStore.getItemAsync('email');
|
||||
const uid = await SecureStore.getItemAsync('userId');
|
||||
setFullName(name || '');
|
||||
setEmail(mail || '');
|
||||
setUserId(uid || '');
|
||||
})();
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<Text style={styles.title}>Profil</Text>
|
||||
<View style={styles.card}>
|
||||
<Text style={styles.label}>Név:</Text>
|
||||
<Text style={styles.value}>{fullName}</Text>
|
||||
<Text style={styles.label}>Email:</Text>
|
||||
<Text style={styles.value}>{email}</Text>
|
||||
<Text style={styles.label}>UserID:</Text>
|
||||
<Text style={styles.value}>{userId}</Text>
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: BG,
|
||||
justifyContent: 'center',
|
||||
alignItems: 'center',
|
||||
},
|
||||
title: {
|
||||
color: '#fff',
|
||||
fontWeight: 'bold',
|
||||
fontSize: 28,
|
||||
textAlign: 'center',
|
||||
marginBottom: 24,
|
||||
},
|
||||
card: {
|
||||
backgroundColor: 'rgba(24, 20, 28, 0.95)',
|
||||
borderRadius: 24,
|
||||
padding: 32,
|
||||
width: '90%',
|
||||
maxWidth: 400,
|
||||
shadowColor: '#000',
|
||||
shadowOpacity: 0.3,
|
||||
shadowRadius: 24,
|
||||
shadowOffset: { width: 0, height: 8 },
|
||||
elevation: 8,
|
||||
},
|
||||
label: {
|
||||
color: '#bdbdbd',
|
||||
fontSize: 16,
|
||||
marginTop: 12,
|
||||
fontWeight: 'bold',
|
||||
},
|
||||
value: {
|
||||
color: PRIMARY,
|
||||
fontSize: 18,
|
||||
marginBottom: 8,
|
||||
},
|
||||
});
|
Reference in New Issue
Block a user