23.12.14.(THU).TIL.
React Native
React Native
import React, { useState, useEffect } from "react";
import {
SafeAreaView,
StyleSheet,
Text,
View,
Button,
} from "react-native";
const App = ({ navigation }) => {
const [isLoggedIn, setIsLoggedIn] = useState(false);
useEffect(() => {
// 로그인 여부를 확인합니다.
setIsLoggedIn(true);
}, []);
if (!isLoggedIn) {
return (
<SafeAreaView style={styles.container}>
<Text style={styles.title}>LifePlan Hub</Text>
<Button
title="로그인"
onPress={() => navigation.navigate("Login")}
/>
</SafeAreaView>
);
}
return (
<SafeAreaView style={styles.container}>
<Text style={styles.title}>LifePlan Hub</Text>
<Button
title="목표"
onPress={() => navigation.navigate("Goals")}
/>
<Button
title="루틴"
onPress={() => navigation.navigate("Routines")}
/>
<Button
title="일정"
onPress={() => navigation.navigate("Calendar")}
/>
<Button
title="커뮤니티"
onPress={() => navigation.navigate("Community")}
/>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
},
title: {
fontSize: 24,
fontWeight: "bold",
},
});
export default App;