-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
70 lines (61 loc) · 1.77 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
66
67
68
69
70
import 'react-native-gesture-handler';
import React from 'react';
import { ActivityIndicator, StyleSheet, View } from 'react-native';
import { StatusBar } from 'expo-status-bar';
import * as SecureStore from 'expo-secure-store';
import { ClerkProvider, SignedIn, SignedOut } from '@clerk/clerk-expo';
import { SafeAreaProvider } from 'react-native-safe-area-context';
import LoginScreen from './app/screens/#_screen/#Screen';
import { PUBLISHABLE_KEY } from './app/utils/config';
import Tabs from './app/navigations/TabNavigation';
import Colors from './app/utils/Colors';
import DismissKeyboardHoc from './app/components/dismisskeyboard.hoc';
import { useCustomFonts } from './app/hooks/useCustomFonts';
export default function App() {
const fontsLoaded = useCustomFonts();
const tokenCache = {
async getToken(key: string) {
try {
return SecureStore.getItemAsync(key);
} catch (err) {
return null;
}
},
async saveToken(key: string, value: string) {
try {
return SecureStore.setItemAsync(key, value);
} catch (err) {
return;
}
},
};
if (!fontsLoaded) {
return <ActivityIndicator />;
}
return (
<ClerkProvider
tokenCache={tokenCache}
publishableKey={PUBLISHABLE_KEY}
>
<SafeAreaProvider>
<DismissKeyboardHoc>
<View style={styles.container}>
<SignedIn>
<Tabs />
</SignedIn>
<SignedOut>
<LoginScreen />
</SignedOut>
<StatusBar style="auto" />
</View>
</DismissKeyboardHoc>
</SafeAreaProvider>
</ClerkProvider>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: Colors.white,
},
});