-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.tsx
41 lines (38 loc) · 1.25 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
// App.tsx
import React, { useState } from 'react';
import { Provider as PaperProvider } from 'react-native-paper';
import { Provider as ReduxProvider } from 'react-redux';
import { SafeAreaProvider } from 'react-native-safe-area-context'; // Add this import
import { store } from './src/store/store';
import { AppNavigator } from './src/navigation/AppNavigator';
import SetupWizard from './src/components/screens/SetupWizard';
/**
* Root Application Component
* Handles:
* - Authentication state
* - Provider wrapping (Redux, Paper, SafeArea)
* - Conditional rendering of Login/Main app
*
* @returns {React.ReactElement} The root application component
*/
export default function App() {
// Track whether user is authenticated
const [isAuthenticated, setIsAuthenticated] = useState(false);
return (
<SafeAreaProvider>
<ReduxProvider store={store}>
<PaperProvider>
{isAuthenticated ? (
// Show main app when authenticated
<AppNavigator />
) : (
// Show login screen when not authenticated
<SetupWizard
onLoginSuccess={() => setIsAuthenticated(true)}
/>
)}
</PaperProvider>
</ReduxProvider>
</SafeAreaProvider>
);
}