import { Ionicons } from '@expo/vector-icons'; import { createBottomTabNavigator } from '@react-navigation/bottom-tabs'; import { createNativeStackNavigator } from '@react-navigation/native-stack'; import { Pressable, StyleSheet, View } from 'react-native'; import { colors } from '../theme/colors'; import { DashboardScreen } from '../screens/DashboardScreen'; import { HistoryScreen } from '../screens/HistoryScreen'; import { AddTransactionScreen } from '../screens/AddTransactionScreen'; import { EditTransactionScreen } from '../screens/EditTransactionScreen'; import { RecurringFormScreen } from '../screens/RecurringFormScreen'; import { TargetFormScreen } from '../screens/TargetFormScreen'; import { CategoryFormScreen } from '../screens/CategoryFormScreen'; import { OnboardingScreen } from '../screens/OnboardingScreen'; import { SavingsScreen } from '../screens/SavingsScreen'; import { SettingsScreen } from '../screens/SettingsScreen'; import type { TransactionType } from '../types'; export type RootTabParamList = { Beranda: undefined; Riwayat: undefined; Catat: { type?: TransactionType } | undefined; Tabungan: undefined; Pengaturan: undefined; }; export type RootStackParamList = { Main: undefined; Onboarding: undefined; EditTransaksi: { transactionId: number }; RecurringForm: undefined; TargetForm: undefined; CategoryForm: | { categoryId?: number; initialName?: string; initialIcon?: string; defaultType?: TransactionType; } | undefined; }; const Tab = createBottomTabNavigator(); const Stack = createNativeStackNavigator(); type IoniconName = React.ComponentProps['name']; const tabIcon = (focusedName: IoniconName, unfocusedName: IoniconName) => ({ color, size, focused }: { color: string; size: number; focused: boolean }) => ( ); /** Tombol "+" melingkar di tengah tab bar (FAB) */ function FabButton({ onPress, accessibilityState, }: { onPress?: (...args: any[]) => void; accessibilityState?: { selected?: boolean }; }) { const focused = accessibilityState?.selected; return ( [styles.fabWrapper, pressed && styles.fabPressed]} hitSlop={8} > ); } function MainTabs() { return ( null, tabBarLabel: () => null, tabBarButton: (props) => , }} /> ); } export function RootNavigator({ initialRoute = 'Main', }: { initialRoute?: 'Main' | 'Onboarding'; }) { return ( ({ presentation: 'modal', headerShown: true, title: route.params?.categoryId != null ? 'Edit Kategori' : 'Kategori Baru', headerTitleStyle: { fontWeight: '700', color: colors.text }, headerStyle: { backgroundColor: colors.background }, headerShadowVisible: false, })} /> ); } const styles = StyleSheet.create({ tabBar: { backgroundColor: colors.surface, borderTopColor: colors.border, borderTopWidth: 1, height: 62, paddingTop: 4, paddingBottom: 6, }, tabLabel: { fontSize: 10, fontWeight: '600', }, fabWrapper: { flex: 1, alignItems: 'center', justifyContent: 'center', top: -24, }, fabPressed: { opacity: 0.85 }, fab: { width: 58, height: 58, borderRadius: 29, backgroundColor: colors.primary, alignItems: 'center', justifyContent: 'center', borderWidth: 4, borderColor: colors.surface, shadowColor: colors.primaryDark, shadowOpacity: 0.35, shadowRadius: 10, shadowOffset: { width: 0, height: 5 }, elevation: 8, }, fabActive: { backgroundColor: colors.primaryDark, }, });