-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.js
More file actions
47 lines (42 loc) · 1.25 KB
/
Copy pathApp.js
File metadata and controls
47 lines (42 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { useState, useEffect } from "react";
import { StatusBar } from "expo-status-bar";
import { StyleSheet, SafeAreaView, Text, View } from "react-native";
import Constants from "expo-constants";
import AsyncStorage from "@react-native-async-storage/async-storage";
import Intro from "./src/Screens/Intro";
import NoteScreen from "./src/Screens/NoteScreen";
export default function App() {
const [user, setUser] = useState({});
const [isOpenFirst, setIsOpenFirst] = useState(false);
const FindUser = async () => {
const userData = await AsyncStorage.getItem("user");
if (userData == null) return setIsOpenFirst(true);
setUser(JSON.parse(userData));
setIsOpenFirst(false);
};
useEffect(() => {
FindUser();
}, []);
if (isOpenFirst)
return (
<View>
<Intro onfinish={FindUser} />
<StatusBar style="auto" backgroundColor="#182746" />
</View>
);
return (
<View style={styles.container}>
<NoteScreen user={user} />
<StatusBar style="auto" backgroundColor="#182746" />
</View>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
paddingTop: Constants.statusBarHeight,
},
});