import React from 'react'; import { View, StyleSheet, TouchableOpacity, Animated } from 'react-native'; import Text from '../atoms/Text'; interface TabOption { key: string; label: string; } interface TabSwitcherProps { options: TabOption[]; activeKey: string; onTabChange: (key: string) => void; containerStyle?: object; activeColor?: string; inactiveColor?: string; } export default function TabSwitcher({ options, activeKey, onTabChange, containerStyle, activeColor = '#FFD700', inactiveColor = '#333333' }: TabSwitcherProps) { if (options.length !== 2) { console.warn('TabSwitcher is designed for exactly 2 options'); } return ( {options.map((option, index) => { const isActive = activeKey === option.key; return ( onTabChange(option.key)} activeOpacity={0.8} > {option.label} ); })} ); } const styles = StyleSheet.create({ container: { alignItems: 'center', marginBottom: 20, width: '100%', }, switchTrack: { flexDirection: 'row', borderRadius: 10, backgroundColor: '#333333', padding: 4, width: '100%', }, tabButton: { flex: 1, paddingVertical: 10, paddingHorizontal: 12, alignItems: 'center', justifyContent: 'center', borderRadius: 8, marginHorizontal: 2, }, leftTabButton: { marginLeft: 0, }, rightTabButton: { marginRight: 0, }, tabText: { fontSize: 15, fontWeight: '600', }, activeTabText: { color: '#000000', }, });