-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
60 lines (53 loc) · 1.54 KB
/
App.tsx
File metadata and controls
60 lines (53 loc) · 1.54 KB
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
import React, { useEffect } from "react";
import { StatusBar } from "expo-status-bar";
import { ActivityIndicator, View, StyleSheet } from "react-native";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { injectIconFontStyles } from "./src/constants/fonts";
import { AuthProvider, useAuth } from "./src/context/AuthContext";
import { HouseProvider } from "./src/context/HouseContext";
import { ThemeProvider } from "./src/context/ThemeContext";
import RootNavigator from "./src/navigation/RootNavigator";
import { useUserTheme } from "./src/hooks/useUserTheme";
const createDynamicStyles = (COLORS: any) =>
StyleSheet.create({
loadingContainer: {
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: COLORS.BACKGROUND,
},
});
function AppContent() {
const { isLoading } = useAuth();
const { COLORS } = useUserTheme();
const styles = createDynamicStyles(COLORS);
if (isLoading) {
return (
<View style={styles.loadingContainer}>
<ActivityIndicator size="large" color={COLORS.PRIMARY} />
</View>
);
}
return (
<>
<RootNavigator />
<StatusBar style="light" backgroundColor={COLORS.PRIMARY} />
</>
);
}
export default function App() {
useEffect(() => {
injectIconFontStyles();
}, []);
return (
<SafeAreaProvider>
<ThemeProvider>
<AuthProvider>
<HouseProvider>
<AppContent />
</HouseProvider>
</AuthProvider>
</ThemeProvider>
</SafeAreaProvider>
);
}