import { router } from "expo-router";
import { useRef, useState } from "react";
import { Image, Text, TouchableOpacity, View } from "react-native";
import { SafeAreaView } from "react-native-safe-area-context";
import Swiper from "react-native-swiper";
import { CustomButton } from "@/components/custom-button";
import { onboarding } from "@/constants";
import { useT } from "@/lib/i18n";
const Welcome = () => {
const swiperRef = useRef(null);
const [activeIndex, setActiveIndex] = useState(0);
const isLastSlide = activeIndex === onboarding.length - 1;
const t = useT();
return (
router.push("/(auth)/sign-up")}
className="w-full flex justify-end items-end p-5"
>
{t("onboarding.skip")}
}
activeDot={}
index={activeIndex}
onIndexChanged={setActiveIndex}
>
{onboarding.map((item) => (
{t(item.titleKey)}
{t(item.descKey)}
))}
isLastSlide
? router.push("/(auth)/sign-up")
: swiperRef.current?.scrollBy(1)
}
title={isLastSlide ? t("onboarding.getStarted") : t("onboarding.next")}
className="w-11/12 mt-10"
/>
);
};
export default Welcome;