import React from 'react'; import { View, Text, Pressable, StyleSheet } from 'react-native'; import { LinearGradient } from 'expo-linear-gradient'; import Svg, { Circle, Line, Path, Polyline, Rect } from 'react-native-svg'; import { colors } from './theme'; export type TabKey = 'device' | 'camera' | 'stream' | 'system' | 'console'; const tabs: { key: TabKey; label: string; icon: (active: boolean) => React.ReactNode }[] = [ { key: 'device', label: 'Device', icon: (active) => ( ), }, { key: 'camera', label: 'Camera', icon: (active) => ( ), }, { key: 'stream', label: 'Stream', icon: (active) => ( ), }, { key: 'system', label: 'System', icon: (active) => ( ), }, { key: 'console', label: 'Console', icon: (active) => ( ), }, ]; export function TabBar({ active, onChange }: { active: TabKey; onChange: (k: TabKey) => void }) { return ( {tabs.map((t) => { const isActive = t.key === active; const inner = ( {t.icon(isActive)} {t.label} ); return ( onChange(t.key)} style={styles.tabWrap}> {isActive ? ( {t.icon(true)} {t.label} ) : ( inner )} ); })} ); } const styles = StyleSheet.create({ outer: { position: 'absolute', left: 12, right: 12, bottom: 12, flexDirection: 'row', alignItems: 'center', backgroundColor: 'rgba(255,255,255,0.85)', borderRadius: 30, borderWidth: 1, borderColor: 'rgba(255,255,255,0.8)', padding: 8, gap: 4, shadowColor: '#0F2A1D', shadowOpacity: 0.14, shadowOffset: { width: 0, height: 14 }, shadowRadius: 44, elevation: 12, }, tabWrap: { flex: 1, minHeight: 60 }, tab: { minHeight: 58, paddingVertical: 10, paddingHorizontal: 8, alignItems: 'center', justifyContent: 'center', gap: 4, borderRadius: 22, }, tabActive: { backgroundColor: '#28473A', }, gradientTab: { minHeight: 58, paddingVertical: 10, paddingHorizontal: 8, alignItems: 'center', justifyContent: 'center', gap: 4, borderRadius: 22, }, label: { fontSize: 11, lineHeight: 13, }, });