// app/(tabs)/library/_layout.web.tsx import React from 'react'; import { View, Pressable } from 'react-native'; import { Text } from '@/components/ui/text'; import { ThemeToggle } from '@/components/ThemeToggle'; import Pager from '@/components/pager'; import { CUSTOM_COLORS } from '@/lib/constants'; import type { PagerRef } from '@/components/pager/types'; import ExercisesScreen from './exercises'; import TemplatesScreen from './templates'; import ProgramsScreen from './programs'; const tabs = [ { key: 'exercises', title: 'Exercises', component: ExercisesScreen }, { key: 'templates', title: 'Templates', component: TemplatesScreen }, { key: 'programs', title: 'Programs', component: ProgramsScreen }, ]; export default function LibraryLayout() { const [activeIndex, setActiveIndex] = React.useState(0); const pagerRef = React.useRef(null); const handleTabPress = (index: number) => { setActiveIndex(index); pagerRef.current?.setPage(index); }; return ( {/* Header */} Library {/* Tab Headers */} {tabs.map((tab, index) => ( handleTabPress(index)} className="px-4 py-3 items-center" > {tab.title} {activeIndex === index && ( )} ))} {/* Content */} setActiveIndex(e.nativeEvent.position)} style={{ flex: 1 }} > {tabs.map((tab) => ( ))} ); }