pogdark-app/app/index.tsx

79 lines
2.3 KiB
TypeScript
Raw Normal View History

import React from 'react';
import {View, StyleSheet, Text } from "react-native";
2025-02-19 18:33:09 +00:00
import { useTheme } from "react-native-paper";
import ProfileScreen from "@/app/ProfileScreen";
import StatusPage from "@/app/StatusPage";
import Nav from "@/app/Nav";
import { useUser } from "@/context/UserContext";
2025-02-19 18:33:09 +00:00
const Index = () => {
const theme = useTheme();
2025-02-19 18:33:09 +00:00
const {
isProfileActive,
setProfileActive,
userId,
userName,
setUserName,
userImage,
setUserImage,
userStatus,
setUserStatus,
setUserDataChanged,
setTheme,
currentTheme,
isLoading,
} = useUser();
2025-02-22 02:56:54 +00:00
if (isLoading) {
console.log("Still loading");
return (
<View style={[styles.container, { backgroundColor: theme.colors.background, justifyContent: 'center', alignItems: 'center' }]}>
2025-02-22 02:56:54 +00:00
<Text>Loading...</Text>
</View>
);
}
2025-02-19 18:33:09 +00:00
return (
<View style={[styles.container, { backgroundColor: theme.colors.background }]}>
<Nav
2025-02-19 18:33:09 +00:00
toggleProfile={() => setProfileActive(true)}
/>
<StatusPage
2025-02-19 18:33:09 +00:00
id={userId}
name={userName}
image={userImage}
currentStatus={userStatus}
setStatus={setUserStatus}
currentTheme={currentTheme}
2025-02-19 18:33:09 +00:00
isProfileActive={isProfileActive}
/>
<ProfileScreen
visible={isProfileActive}
id={userId}
name={userName}
setName={setUserName}
image={userImage}
setImage={setUserImage}
setTheme={setTheme}
currentTheme={currentTheme}
2025-02-22 02:56:54 +00:00
setChanged={setUserDataChanged}
2025-02-19 18:33:09 +00:00
onClose={() => setProfileActive(false)}
/>
</View>
);
};
const styles = StyleSheet.create({
container: { flex: 1, alignItems: "stretch" },
imageBackground: {
position: "absolute", // Allows child elements to layer on top
width: "100%", // Ensure full coverage of the column
height: "100%", // Fully stretches to column height
resizeMode: "cover", // Ensures it fits well
opacity: 0.3, // Fades the image
},
2025-02-19 18:33:09 +00:00
});
export default Index;