import React from 'react'; import { View, TouchableOpacity, ActivityIndicator } from 'react-native'; import { ThemedText } from '@/components/themed-text'; import { useColorScheme } from '@/hooks/use-color-scheme'; type TabKey = 'all' | 'image' | 'video'; const TABS: { key: TabKey; label: string }[] = [ { key: 'all', label: 'All' }, { key: 'image', label: 'Image' }, { key: 'video', label: 'Video' }, ]; export function ContentTabs({ activeTab, onChangeTab, isLoading = false, }: { activeTab: TabKey; onChangeTab: (tab: TabKey) => void; isLoading?: boolean; }) { const colorScheme = useColorScheme(); const palette = colorScheme === 'dark' ? darkPalette : lightPalette; return ( {TABS.map(tab => { const isActive = tab.key === activeTab; return ( onChangeTab(tab.key)} disabled={isLoading} style={[ styles.tabButton, { backgroundColor: isActive ? palette.tabActive : 'transparent', }, ]} > {isActive && isLoading ? ( ) : ( {tab.label} )} ); })} ); } const darkPalette = { pill: '#16171C', border: '#1D1E24', tabActive: '#FFFFFF', onAccent: '#050505', textSecondary: '#8E9098', }; const lightPalette = { pill: '#E8EBF4', border: '#E2E5ED', tabActive: '#FFFFFF', onAccent: '#FFFFFF', textSecondary: '#5E6474', }; const styles = { tabsBar: { flexDirection: 'row' as const, alignItems: 'center' as const, borderWidth: 0, borderRadius: 999, padding: 0, }, tabButton: { flex: 1, borderRadius: 999, paddingVertical: 10, alignItems: 'center' as const, justifyContent: 'center' as const, }, tabLabel: { fontSize: 15, fontWeight: '600' as const, }, loadingIndicator: { height: 18, }, };