forked from rish-singhal/Pause-front-end
-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
63 lines (56 loc) · 1.93 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import * as React from 'react'
import { Provider as StoreProvider} from 'react-redux'
import { Provider as PaperProvider } from 'react-native-paper';
import { NavigationContainer } from '@react-navigation/native'
import store from './src/reducers';
import { navigationRef } from './src/services/navRef'
import Navigation from "./src/navigation/Navigation";
import {useEffect, useState} from "react";
import {loggedIn} from "./src/actions/auth";
import {getAuthAsyncStorage} from "./src/services/getAuthAsyncStorage";
import { theme } from './src/core/theme';
import 'react-native-gesture-handler';
export default function App() {
const [isLoading, setIsLoadingFromAsyncStorage] = useState(true);
useEffect(() => {
const load = async () => {
await setIsLoadingFromAsyncStorage(true);
const userStorage = await getAuthAsyncStorage();
if (userStorage.user && userStorage.token) {
await store.dispatch(loggedIn({
user: userStorage.user,
token: userStorage.token,
}));
}
await setIsLoadingFromAsyncStorage(false);
}
load();
}, []);
if (isLoading) {
return null;
}
return (
<StoreProvider store={store}>
<PaperProvider theme={theme}>
<NavigationContainer ref={navigationRef}>
<Navigation />
</NavigationContainer>
</PaperProvider>
</StoreProvider>
)
}
{/* <Stack.Navigator
initialRouteName="StartScreen"
screenOptions={{
headerShown: false,
}}
>
<Stack.Screen name="StartScreen" component={StartScreen} />
<Stack.Screen name="LoginScreen" component={LoginScreen} />
<Stack.Screen name="RegisterScreen" component={RegisterScreen} />
<Stack.Screen name="Dashboard" component={Dashboard} />
<Stack.Screen
name="ResetPasswordScreen"
component={ResetPasswordScreen}
/>
</Stack.Navigator> */}