import React from "react"; import { View, Pressable, ScrollView, ActivityIndicator } from "react-native"; import { Text } from "@/components/ui/text"; import { cn } from "@/lib/utils"; import { ArrowLeft, ArrowRight } from "@/lib/icons"; import { useSirouRouter } from "@sirou/react-native"; import { AppRoutes } from "@/lib/routes"; interface Step { key: string; label: string; } interface FormFlowProps { steps: Step[]; currentStep: number; onNext: () => void; onBack: () => void; onComplete: () => void; children: React.ReactNode; loading?: boolean; nextLabel?: string; completeLabel?: string; hideFooter?: boolean; hideHeader?: boolean; } export function FormFlow({ steps, currentStep, onNext, onBack, onComplete, children, loading = false, nextLabel = "Continue", completeLabel = "Submit", hideFooter = false, hideHeader = false, }: FormFlowProps) { const nav = useSirouRouter(); const isFirst = currentStep === 0; const isLast = currentStep === steps.length - 1; return ( {!hideHeader && ( nav.back() : onBack} className="h-9 w-9 rounded-[8px] border border-border items-center justify-center" > {currentStep + 1} / {steps.length} )} {steps.map((step, idx) => ( ))} {children} {!hideFooter && ( {loading ? ( ) : ( <> {isLast ? completeLabel : nextLabel} {!isLast && } )} )} ); }