-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
66 lines (61 loc) · 1.63 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
64
65
66
import { StyleSheet, SafeAreaView, View } from 'react-native'
import Login from './app/screens/Login'
import { ClerkProvider, SignedIn, SignedOut } from '@clerk/clerk-expo'
import * as SecureStore from 'expo-secure-store'
import { NavigationContainer } from '@react-navigation/native'
import TabNavigation from './app/navigations/TabNavigation'
import { useFonts } from 'expo-font'
import { ToastProvider } from 'react-native-toast-notifications'
import { ConfigProvider } from './app/shared/ConfigContext'
const tokenCache = {
async getToken(key) {
try {
return SecureStore.getItemAsync(key)
} catch (err) {
return null
}
},
async saveToken(key, value) {
try {
return SecureStore.setItemAsync(key, value)
} catch (err) {
return
}
},
}
export default function App() {
const [fontsLoaded] = useFonts({
'Roboto-Regular': require('./assets/fonts/Roboto-Regular.ttf'),
'Roboto-Light': require('./assets/fonts/Roboto-Light.ttf'),
'Roboto-Medium': require('./assets/fonts/Roboto-Medium.ttf'),
'Roboto-Bold': require('./assets/fonts/Roboto-Bold.ttf'),
})
if (!fontsLoaded) return null
return (
<ToastProvider>
<ConfigProvider>
<ClerkProvider
tokenCache={tokenCache}
publishableKey={process.env.EXPO_PUBLIC_CLERK_KEY}
>
<View style={styles.container}>
<SignedIn>
<NavigationContainer>
<TabNavigation />
</NavigationContainer>
</SignedIn>
<SignedOut>
<Login />
</SignedOut>
</View>
</ClerkProvider>
</ConfigProvider>
</ToastProvider>
)
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#fff',
},
})