-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
43 lines (37 loc) · 1.24 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
import React from "react";
import { NavigationContainer } from "@react-navigation/native";
import { PaperProvider } from "react-native-paper";
import { PreferencesProvider } from "./src/providers/PreferencesContext";
import { StatusBar } from "expo-status-bar";
import AppBottomTab from "./src/navigation/AppBottomTab";
import { View } from "react-native";
import { en, registerTranslation } from "react-native-paper-dates";
import useCustomFonts from "./src/hooks/useCustomFonts";
import useTheme from "./src/hooks/useTheme";
import AppLoading from "./src/components/AppLoading";
registerTranslation("en", en);
const App: React.FC = () => {
return (
<PreferencesProvider>
<MainApp />
</PreferencesProvider>
);
};
const MainApp: React.FC = () => {
const { fontsLoaded, onLayoutRootView } = useCustomFonts();
const { theme, isThemeDark } = useTheme();
if (!fontsLoaded) {
return <AppLoading />;
}
return (
<PaperProvider theme={theme}>
<NavigationContainer theme={theme}>
<View onLayout={onLayoutRootView} style={{ flex: 1 }}>
<StatusBar style={isThemeDark ? "light" : "dark"} />
<AppBottomTab />
</View>
</NavigationContainer>
</PaperProvider>
);
};
export default App;