-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.tsx
More file actions
49 lines (44 loc) · 1.39 KB
/
App.tsx
File metadata and controls
49 lines (44 loc) · 1.39 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
import React, { useState } from "react";
import { ActivityIndicator, View } from "react-native";
import { SafeAreaProvider } from "react-native-safe-area-context";
import { Provider } from "react-redux";
import { PersistGate } from "redux-persist/integration/react";
import { AuthProvider } from "./src/context/AuthContext";
import { ThemeProvider, useTheme } from "./src/context/ThemeContext";
import RootNavigator from "./src/navigation/RootNavigator";
import SplashScreen from "./src/screens/SplashScreen";
import { persistor, store } from "./src/store";
function AppContent() {
const { loading } = useTheme();
const [showSplash, setShowSplash] = useState(true);
// Show custom splash screen
if (showSplash) {
return <SplashScreen onFinish={() => setShowSplash(false)} />;
}
// Show loading indicator while theme loads
if (loading) {
return (
<View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
<ActivityIndicator size="large" color="#2196F3" />
</View>
);
}
return (
<AuthProvider>
<RootNavigator />
</AuthProvider>
);
}
export default function App() {
return (
<Provider store={store}>
<PersistGate loading={null} persistor={persistor}>
<SafeAreaProvider>
<ThemeProvider>
<AppContent />
</ThemeProvider>
</SafeAreaProvider>
</PersistGate>
</Provider>
);
}