-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
34 lines (29 loc) · 1.23 KB
/
App.tsx
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
import { SignIn } from "./SignIn";
import { # } from "./#";
import { Home } from "./Home";
import { Chat } from "./Chat";
import { Profile } from "./Profile";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import AsyncStorage from '@react-native-async-storage/async-storage';
import { Alert } from "react-native";
const Stack = createNativeStackNavigator();
function App(){
async function checkUser(){
const user = await AsyncStorage.getItem("user");
return user;
}
const ui = (
<NavigationContainer>
<Stack.Navigator initialRouteName={checkUser !== null?"Home":"#"}>
<Stack.Screen name="#" component={#} options={{headerShown: false}}/>
<Stack.Screen name="Home" component={Home} options={{headerShown: false}}/>
<Stack.Screen name="#" component={SignIn} options={{headerShown: false}}/>
<Stack.Screen name="Chat" component={Chat} options={{headerShown: false}}/>
<Stack.Screen name="Profile" component={Profile} options={{headerShown: false}}/>
</Stack.Navigator>
</NavigationContainer>
);
return ui;
}
export default App;