-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
43 lines (40 loc) · 1.43 KB
/
App.js
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
import "react-native-gesture-handler";
import React from "react";
import { StyleSheet, Text } from "react-native";
import Login from "./app/Auth/Login";
import { NativeBaseProvider } from "native-base";
import { useState } from "react";
import { useFonts } from "expo-font";
import { Provider } from "react-redux";
import Dashboard from "./app/Screens/Admin/Dashboard.jsx"
import store from "./app/store";
import LoadingScreen from "./app/Screens/LoadingScreen";
export default function App() {
const [CurrentPage, PageHandler] = useState(0);
const [LoggedUser, setLoggedUser] = useState({});
let [fontsLoaded] = useFonts({
"Cairo": require("./assets/fonts/Cairo.ttf"),
"Heebo": require("./assets/fonts/Heebo.ttf"),
"RobotoFlex-wght": require("./assets/fonts/RobotoFlex-wght.ttf"),
});
if (!fontsLoaded) {
return <Text>Loading</Text>;
}
return (
<Provider store={store}>
<NativeBaseProvider style={styles.container}>
{CurrentPage == 0 && <LoadingScreen setLoggedUser={setLoggedUser} PageHandler={PageHandler} />}
{CurrentPage == 1 && <Login setLoggedUser={setLoggedUser} PageHandler={PageHandler} />}
{CurrentPage == 2 && <Dashboard LoggedUser={LoggedUser} PageHandler={PageHandler} />}
</NativeBaseProvider>
</Provider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#fff",
alignItems: "center",
justifyContent: "center",
},
});