-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
53 lines (42 loc) · 1.35 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
import React, { useEffect, useState } from 'react';
import { useColorScheme } from 'react-native';
import { useFonts } from 'expo-font';
import * as SplashScreen from 'expo-splash-screen';
import {Ionicons} from "@expo/vector-icons";
import { NavigationContainer } from '@react-navigation/native';
import Root from './navigation/Root';
import { darkTheme, lightTheme } from './styled';
import { ThemeProvider } from 'styled-components';
import { QueryClient, QueryClientProvider} from "react-query";
SplashScreen.preventAutoHideAsync();
const queryClient = new QueryClient();
export default function App() {
const [appIsReady, setAppIsReady] = useState(false);
// const [assetLoaded] = useAssets([require('./godiva.jpeg')]);
const [fontsLoaded] = useFonts(Ionicons.font);
useEffect(() => {
async function prepare() {
try {
await SplashScreen.hideAsync();
} catch (e) {
console.warn(e);
} finally {
setAppIsReady(true);
}
}
prepare();
}, []);
const isDark = useColorScheme() === 'dark';
if (!appIsReady) {
return null;
}
return (
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={isDark? darkTheme : lightTheme}>
<NavigationContainer>
<Root />
</NavigationContainer>
</ThemeProvider>
</QueryClientProvider>
)
}