import { Tabs, useRouter } from 'expo-router'; import type { ComponentProps } from 'react'; import { Pressable, StyleSheet, Text, View } from 'react-native'; import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { CameraIcon } from '../../src/components/Icons'; import { colors, font, radius, shadow } from '../../src/theme'; const TABS = [ { name: 'index', label: 'Start' }, { name: 'archive', label: 'Archiv' }, ] as const; // expo-router vendors its own copy of react-navigation, so take the tab bar // props straight off the component rather than deep-importing the type. type TabBarProps = Parameters['tabBar']>>[0]; /** * The design's bottom bar: two labels either side of a floating scan button * that overhangs the bar. Active state is a filled bullet above the label. */ function TabBar({ state, navigation }: TabBarProps) { const router = useRouter(); const insets = useSafeAreaInsets(); const activeRoute = state.routes[state.index]?.name; return ( {TABS.map((tab, i) => { const active = activeRoute === tab.name; const item = ( navigation.navigate(tab.name)} accessibilityRole="tab" accessibilityState={{ selected: active }} > {active ? '●' : '○'} {tab.label} ); // Slot the floating scan button between the two tabs. return i === 0 ? [ item, [styles.fab, pressed && styles.fabPressed]} onPress={() => router.push('/scan')} accessibilityRole="button" accessibilityLabel="Brief scannen" > , ] : item; })} ); } export default function TabsLayout() { return ( }> ); } const styles = StyleSheet.create({ bar: { flexDirection: 'row', alignItems: 'center', justifyContent: 'space-around', paddingTop: 12, paddingHorizontal: 20, backgroundColor: colors.surface, borderTopLeftRadius: radius['4xl'], borderTopRightRadius: radius['4xl'], ...shadow.tabBar, }, tab: { alignItems: 'center' }, bullet: { fontSize: 11, lineHeight: 14 }, label: { fontFamily: font.bold, fontSize: 11, color: colors.slateLight, textAlign: 'center' }, labelActive: { fontFamily: font.extrabold, fontSize: 11, color: colors.blue, textAlign: 'center', }, fab: { width: 56, height: 56, borderRadius: 28, backgroundColor: colors.blue, alignItems: 'center', justifyContent: 'center', marginTop: -30, borderWidth: 4, borderColor: colors.canvas, ...shadow.fab, }, fabPressed: { opacity: 0.85 }, });