Skip to content

Commit

Permalink
Started migrating nav! (#209)
Browse files Browse the repository at this point in the history
* added general structure for navigation

* fixing error
  • Loading branch information
AlexanderWangY authored Apr 4, 2024
1 parent 7b7b946 commit 358cc9a
Show file tree
Hide file tree
Showing 4 changed files with 237 additions and 121 deletions.
44 changes: 38 additions & 6 deletions client/App.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,44 @@
import React from "react";
import { StyleSheet, View, Text } from "react-native";
import { AuthStore } from "./src/services/store";
import { NavigationContainer } from "@react-navigation/native";
import { createStackNavigator } from "@react-navigation/stack";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import WelcomeScreen from "./src/components/Home/WelcomeScreen";
import SignUpScreen from "./src/components/Auth/SignUpScreen";
import LoginScreen from "./src/components/Auth/LoginScreen";
import ChatScreen from "./src/components/Chat/ChatScreen";
import SettingsScreen from "./src/components/Settings/SettingsScreen";

const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();

const App = () => {
const { initialized, isLoggedin } = AuthStore.useState();

if (!initialized) return <Text>Loading...</Text>;

export default function App() {
return (
<View>
<Text>This Componenet is DEPRECATED.</Text>
<Text>DO NOT TOUCH. THE NEW ENTRY POINT IS AT 'app/index.tsx'</Text>
</View>
<NavigationContainer>
{isLoggedin ? (
<Tab.Navigator>
<Tab.Screen name="Home" component={ChatScreen} />
<Tab.Screen name="Settings" component={SettingsScreen} />
</Tab.Navigator>
) : (
<Stack.Navigator
screenOptions={{
headerShown: false,
}}
>
<Stack.Screen name="Welcome" component={WelcomeScreen} />
<Stack.Screen name="Login" component={SignUpScreen} />
<Stack.Screen name="Register" component={LoginScreen} />
</Stack.Navigator>
)}
</NavigationContainer>
);
}
};

const styles = StyleSheet.create({
container: {
Expand All @@ -18,3 +48,5 @@ const styles = StyleSheet.create({
justifyContent: "center",
},
});

export default App;
Loading

0 comments on commit 358cc9a

Please sign in to comment.