Initial commit: Prism messenger with Expo + NestJS + GraphQL + PostgreSQL

This commit is contained in:
Bivekich
2025-08-06 02:19:37 +03:00
commit 6fb83334d6
56 changed files with 24295 additions and 0 deletions

View File

@ -0,0 +1,68 @@
import React from 'react';
import { NavigationContainer } from '@react-navigation/native';
import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { useAuth } from '../contexts/AuthContext';
import { LoginScreen } from '../screens/LoginScreen';
import { RegisterScreen } from '../screens/RegisterScreen';
import { ConversationsScreen } from '../screens/ConversationsScreen';
import { ChatScreen } from '../screens/ChatScreen';
import { ActivityIndicator, View } from 'react-native';
const Stack = createNativeStackNavigator();
export const AppNavigator = () => {
const { user, isLoading } = useAuth();
if (isLoading) {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<ActivityIndicator size="large" />
</View>
);
}
return (
<NavigationContainer>
<Stack.Navigator>
{user ? (
<>
<Stack.Screen
name="Conversations"
component={ConversationsScreen}
options={{
title: 'Чаты',
headerLargeTitle: true,
}}
/>
<Stack.Screen
name="Chat"
component={ChatScreen}
options={({ route }) => ({
title: route.params?.title || 'Чат',
})}
/>
</>
) : (
<>
<Stack.Screen
name="Login"
component={LoginScreen}
options={{
title: 'Вход',
headerShown: false,
}}
/>
<Stack.Screen
name="Register"
component={RegisterScreen}
options={{
title: 'Регистрация',
headerShown: false,
}}
/>
</>
)}
</Stack.Navigator>
</NavigationContainer>
);
};