import Ridelayout from "@/components/RideLayout";
import { FlatList, Text, View } from "react-native";
import DriverCard from "@/components/DriverCard";
import CustomButton from "@/components/CustomButton";
import tw from "twrnc";
import { router } from "expo-router";
import { useDriverStore } from "@/store";
const ConfirmRide =() => {
const {drivers,selectedDriver,setSelectedDriver} = useDriverStore();
    return(
        <Ridelayout title="Choose a Driver" snapPoints={["65%","85%"]} >
            <FlatList data={drivers} renderItem={({item})=>  
              <DriverCard item={item} selected={selectedDriver!} setSelected={()=>setSelectedDriver(Number(item.id)!)} /> } 
              ListFooterComponent={()=>(
              <View style={tw`mx-5 mt-10`} >
                <CustomButton title="Select Ride" onPress={() => router.push("/(root)/book-ride")} />
              </View>
              )}
              />  
        </Ridelayout>
    )
}
export default ConfirmRide;