import React, { useState } from 'react'; import { View, StyleSheet, Text, Pressable, ScrollView } from 'react-native'; import { NativeStackScreenProps } from '@react-navigation/native-stack'; import Ionicons from '@react-native-vector-icons/ionicons'; import Animated, { FadeIn, FadeInRight, FadeInLeft } from 'react-native-reanimated'; import { ScreenShell } from '../../../components'; import { useTheme, fontFamily } from '../../../theme'; import type { AgentLoansStackParamList } from '../navigation/agentNavigationTypes'; import LoanRequestListScreen from './LoanRequestListScreen'; import CommissionDashboardScreen from './CommissionDashboardScreen'; import AccountOpeningScreen from './AccountOpeningScreen'; type Props = NativeStackScreenProps; type TabKey = 'loans' | 'commission' | 'account'; export default function AgentLoansScreen({ route, navigation }: Props) { const theme = useTheme(); const [activeTab, setActiveTab] = useState(route.params?.initialTab || 'loans'); const tabs: { key: TabKey; label: string; icon: string }[] = [ { key: 'loans', label: 'Loans', icon: 'document-text-outline' }, { key: 'commission', label: 'Commission', icon: 'star-outline' }, { key: 'account', label: 'New A/C', icon: 'person-add-outline' }, ]; return ( Agent Workspace {tabs.map((tab) => { const isActive = activeTab === tab.key; return ( setActiveTab(tab.key)} > {tab.label} ); })} {activeTab === 'loans' && ( )} {activeTab === 'commission' && ( )} {activeTab === 'account' && ( )} ); } const styles = StyleSheet.create({ header: { paddingHorizontal: 16, paddingTop: 16, paddingBottom: 8, }, headerTitle: { fontSize: 22, fontFamily: fontFamily.bold, letterSpacing: -0.5, }, tabContainer: { flexDirection: 'row', paddingHorizontal: 16, marginBottom: 12, gap: 8, }, tab: { flex: 1, flexDirection: 'row', alignItems: 'center', justifyContent: 'center', paddingVertical: 10, borderRadius: 12, borderWidth: 1, gap: 6, }, tabLabel: { fontSize: 12, fontFamily: fontFamily.bold, }, contentArea: { flex: 1, }, });