-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
65 lines (61 loc) · 1.51 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
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
64
65
/**
* Sample React Native App
* https://github.com/facebook/react-native
*
* Generated with the TypeScript template
* https://github.com/react-native-community/react-native-template-typescript
*
* @format
*/
import React from 'react';
import {SafeAreaView, StatusBar} from 'react-native';
import {ThemeProvider} from 'react-native-elements';
import {QueryClient, QueryClientProvider} from 'react-query';
import Home from './screens/Home';
import {SafeAreaProvider} from 'react-native-safe-area-context';
import AuthContext from './context/AuthContext';
import useAuth from './hooks/useAuth';
declare const global: {HermesInternal: null | {}};
const theme = {
Button: {
raised: true,
},
};
const queryClient = new QueryClient();
const App = () => {
/*[
isLoggedIn,
loggedInAuthToken,
getTok,
promptAsync,
anonTok,
]*/
return (
<SafeAreaProvider>
<ThemeProvider theme={theme}>
<StatusBar barStyle="dark-content" />
<SafeAreaView style={{flex: 1}}>
<QueryClientProvider client={queryClient}>
<AuthHelper />
</QueryClientProvider>
</SafeAreaView>
</ThemeProvider>
</SafeAreaProvider>
);
};
const AuthHelper = () => {
const [isLoggedIn, promptAsync, logout, tok] = useAuth();
const authVals = {
isLoggedIn: isLoggedIn,
promptAsync: promptAsync,
logout: logout,
tok: tok,
};
return (
// @ts-ignore
<AuthContext.Provider value={authVals}>
<Home />
</AuthContext.Provider>
);
};
export default App;