import React from 'react'; import { StyleSheet, TouchableOpacity, View } from 'react-native'; import { useTheme } from './themes'; const tabsStyles = StyleSheet.create({ root: { flexDirection: 'row', height: 50, borderColor: '#e3e3e3', borderBottomWidth: 1, }, tabRoot: { flex: 1, justifyContent: 'center', alignItems: 'center', borderColor: 'white', borderBottomWidth: 2, }, activeTabRoot: { borderColor: 'transparent', borderBottomWidth: 2, }, marginBottom: { marginBottom: 30, }, }); interface TabProps { active: boolean; } interface TabsProps { active: number; onSwitch: (index: number) => void; tabs: React.ComponentType[]; isIpad?: boolean; } export const Tabs: React.FC = ({ active, onSwitch, tabs, isIpad = false }) => { const { colors } = useTheme(); return ( {tabs.map((Tab, i) => ( onSwitch(i)} style={[tabsStyles.tabRoot, active === i && { ...tabsStyles.activeTabRoot, borderColor: colors.buttonAlternativeTextColor }]} > ))} ); };