import React from 'react'; import { createStackNavigator } from '@react-navigation/stack'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; import { createDrawerNavigator } from '@react-navigation/drawer'; import Icon from 'react-native-vector-icons/MaterialCommunityIcons'; import { Platform } from 'react-native'; import { useAuth } from '../contexts/AuthContext'; import { theme } from '../theme/theme'; // Écrans d'authentification import LoginScreen from '../screens/auth/LoginScreen'; import RegisterScreen from '../screens/auth/RegisterScreen'; import ForgotPasswordScreen from '../screens/auth/ForgotPasswordScreen'; import BiometricSetupScreen from '../screens/auth/BiometricSetupScreen'; // Écrans principaux import HomeScreen from '../screens/home/HomeScreen'; import CotisationsScreen from '../screens/cotisations/CotisationsScreen'; import PaymentScreen from '../screens/payment/PaymentScreen'; import WavePaymentScreen from '../screens/payment/WavePaymentScreen'; import ProfileScreen from '../screens/profile/ProfileScreen'; import AssociationsScreen from '../screens/associations/AssociationsScreen'; import MembersScreen from '../screens/members/MembersScreen'; import EventsScreen from '../screens/events/EventsScreen'; import AideMutuelleScreen from '../screens/aide/AideMutuelleScreen'; import NotificationsScreen from '../screens/notifications/NotificationsScreen'; import SettingsScreen from '../screens/settings/SettingsScreen'; // Écrans de workflow import WorkflowScreen from '../screens/workflow/WorkflowScreen'; import AdhesionWorkflowScreen from '../screens/workflow/AdhesionWorkflowScreen'; // Types de navigation export type RootStackParamList = { Auth: undefined; Main: undefined; Payment: { type: 'cotisation' | 'adhesion' | 'aide' | 'evenement'; amount?: string }; WavePayment: { type: 'cotisation' | 'adhesion' | 'aide' | 'evenement'; amount: string; description: string; metadata?: any; }; Workflow: { workflowId: string; instanceId?: string }; AdhesionWorkflow: { associationId: string }; }; export type AuthStackParamList = { Login: undefined; Register: undefined; ForgotPassword: undefined; BiometricSetup: undefined; }; export type MainTabParamList = { Home: undefined; Cotisations: undefined; Associations: undefined; Profile: undefined; More: undefined; }; export type DrawerParamList = { MainTabs: undefined; Members: undefined; Events: undefined; AideMutuelle: undefined; Notifications: undefined; Settings: undefined; }; const RootStack = createStackNavigator(); const AuthStack = createStackNavigator(); const MainTab = createBottomTabNavigator(); const Drawer = createDrawerNavigator(); /** * Navigateur d'authentification */ const AuthNavigator: React.FC = () => { return ( ); }; /** * Navigateur à onglets principal */ const MainTabNavigator: React.FC = () => { return ( ({ headerShown: false, tabBarIcon: ({ focused, color, size }) => { let iconName: string; switch (route.name) { case 'Home': iconName = focused ? 'home' : 'home-outline'; break; case 'Cotisations': iconName = focused ? 'credit-card' : 'credit-card-outline'; break; case 'Associations': iconName = focused ? 'account-group' : 'account-group-outline'; break; case 'Profile': iconName = focused ? 'account' : 'account-outline'; break; case 'More': iconName = focused ? 'menu' : 'menu'; break; default: iconName = 'circle'; } return ; }, tabBarActiveTintColor: theme.colors.primary, tabBarInactiveTintColor: theme.custom.colors.textSecondary, tabBarStyle: { backgroundColor: theme.colors.surface, borderTopWidth: 1, borderTopColor: theme.custom.colors.border, height: Platform.OS === 'ios' ? 83 : 60, paddingBottom: Platform.OS === 'ios' ? 20 : 8, paddingTop: 8, }, tabBarLabelStyle: { fontSize: theme.custom.typography.sizes.xs, fontFamily: theme.custom.typography.families.medium, }, })} > ); }; /** * Écran "Plus" avec navigation vers les autres sections */ const MoreScreen: React.FC = ({ navigation }: any) => { const menuItems = [ { title: 'Membres', icon: 'account-multiple', screen: 'Members' }, { title: 'Événements', icon: 'calendar', screen: 'Events' }, { title: 'Aide Mutuelle', icon: 'hand-heart', screen: 'AideMutuelle' }, { title: 'Notifications', icon: 'bell', screen: 'Notifications' }, { title: 'Paramètres', icon: 'cog', screen: 'Settings' }, ]; return (
{menuItems.map((item, index) => (
navigation.navigate(item.screen)} > {item.title}
))}
); }; /** * Navigateur avec tiroir (drawer) */ const DrawerNavigator: React.FC = () => { return ( ( ), }} /> ( ), }} /> ( ), }} /> ( ), }} /> ( ), }} /> ( ), }} /> ); }; /** * Navigateur principal de l'application */ const AppNavigator: React.FC = () => { const { isAuthenticated } = useAuth(); return ( {!isAuthenticated ? ( ) : ( <> )} ); }; export default AppNavigator;