import { Button } from '@/components/ui/button'; import { Carousel, CarouselItem, CarouselRef } from '@/components/ui/carousel'; import { Text } from '@/components/ui/text'; import { View } from '@/components/ui/view'; import { ChevronLeft, ChevronRight, RotateCcw } from 'lucide-react-native'; import React, { useRef, useState } from 'react'; export function CarouselManual() { const totalSlides = 4; const carouselRef = useRef(null); const [currentIndex, setCurrentIndex] = useState(0); const lessons = [ { title: 'Introduction to React Native', progress: 0, duration: '15 min', bg: '#9c27b0', color: '#f3e5f5', }, { title: 'Component Architecture', progress: 45, duration: '20 min', bg: '#ff5722', color: '#fff3e0', }, { title: 'State Management', progress: 75, duration: '25 min', bg: '#00bcd4', color: '#e0f2f1', }, { title: 'Navigation Patterns', progress: 100, duration: '18 min', bg: '#ff4081', color: '#fce4ec', }, ]; const handleGoToSlide = (index: number) => { if (carouselRef.current?.goToSlide) { carouselRef.current.goToSlide(index); } }; const handleGoToPrevious = () => { if (currentIndex > 0) { if (carouselRef.current?.goToPrevious) { carouselRef.current.goToPrevious(); } } }; const handleGoToNext = () => { if (currentIndex < totalSlides - 1) { if (carouselRef.current?.goToNext) { carouselRef.current.goToNext(); } } }; const handleReset = () => { if (carouselRef.current?.goToSlide) { carouselRef.current.goToSlide(0); } }; // Handle index changes from carousel (swipe gestures AND button presses) const handleIndexChange = (index: number) => { setCurrentIndex(index); }; return ( {/* External Controls */} ))} ); }