Blame · Line-by-line history
App.tsx
Each line is annotated with the commit that last touched it. Click any SHA to jump to that commit and see the surrounding change.
| 9a8fbed | 1 | import React from 'react'; |
| 2 | import { NavigationContainer, DefaultTheme } from '@react-navigation/native'; | |
| 3 | import { SafeAreaProvider } from 'react-native-safe-area-context'; | |
| 4 | import { StatusBar } from 'expo-status-bar'; | |
| 5 | import { View, ActivityIndicator, StyleSheet } from 'react-native'; | |
| 6 | import { AppNavigator } from './src/navigation/AppNavigator'; | |
| 7 | import { AuthNavigator } from './src/navigation/AuthNavigator'; | |
| 8 | import { useAuth } from './src/hooks/useAuth'; | |
| 9 | import { colors } from './src/theme/colors'; | |
| 10 | ||
| 11 | const NavTheme = { | |
| 12 | ...DefaultTheme, | |
| 13 | dark: true, | |
| 14 | colors: { | |
| 15 | ...DefaultTheme.colors, | |
| 16 | primary: colors.accentBlue, | |
| 17 | background: colors.bg, | |
| 18 | card: colors.bgSecondary, | |
| 19 | text: colors.text, | |
| 20 | border: colors.border, | |
| 21 | notification: colors.accentRed, | |
| 22 | }, | |
| 23 | }; | |
| 24 | ||
| 25 | function RootNavigator(): React.ReactElement { | |
| 26 | const { isAuthenticated, isLoading } = useAuth(); | |
| 27 | ||
| 28 | if (isLoading) { | |
| 29 | return ( | |
| 30 | <View style={styles.splash}> | |
| 31 | <ActivityIndicator size="large" color={colors.accentBlue} /> | |
| 32 | </View> | |
| 33 | ); | |
| 34 | } | |
| 35 | ||
| 36 | return isAuthenticated ? <AppNavigator /> : <AuthNavigator />; | |
| 37 | } | |
| 38 | ||
| 39 | export default function App(): React.ReactElement { | |
| 40 | return ( | |
| 41 | <SafeAreaProvider> | |
| 42 | <StatusBar style="light" /> | |
| 43 | <NavigationContainer theme={NavTheme}> | |
| 44 | <RootNavigator /> | |
| 45 | </NavigationContainer> | |
| 46 | </SafeAreaProvider> | |
| 47 | ); | |
| 48 | } | |
| 49 | ||
| 50 | const styles = StyleSheet.create({ | |
| 51 | splash: { | |
| 52 | flex: 1, | |
| 53 | backgroundColor: colors.bg, | |
| 54 | alignItems: 'center', | |
| 55 | justifyContent: 'center', | |
| 56 | }, | |
| 57 | }); |