-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
44 lines (38 loc) · 1.11 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
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useFonts } from 'expo-font';
import * as SplashScreen from 'expo-splash-screen';
import React, { useCallback } from 'react';
import { SafeAreaView } from 'react-native';
import { RootStack } from './src/navigation/RootStack';
import colors from './src/theme/colors';
const queryClient = new QueryClient({
defaultOptions: {
queries: {
refetchOnMount: false,
cacheTime: 15 * 60 * 1000, // set cacheTime to 10 minutes
},
},
});
function App() {
const [fontsLoaded] = useFonts({
'PermanentMarker-Regular': require('./assets/fonts/CarterOne-Regular.ttf'),
});
const onLayoutRootView = useCallback(async () => {
if (fontsLoaded) {
await SplashScreen.hideAsync();
}
}, [fontsLoaded]);
if (!fontsLoaded) {
return null;
}
return (
<SafeAreaView
style={{ flex: 1, backgroundColor: colors.blue[500] }}
onLayout={onLayoutRootView}>
<QueryClientProvider client={queryClient}>
<RootStack />
</QueryClientProvider>
</SafeAreaView>
);
}
export default App;