import { View, Text, ScrollView, TouchableOpacity } from 'react-native' import React, { useState } from 'react' import TabBar from '../themes/TabBar' import { ChevronLeftIcon } from 'react-native-heroicons/outline' import { widthPercentageToDP as wp, heightPercentageToDP as hp, heightPercentageToDP } from 'react-native-responsive-screen'; import { Feather, Ionicons, MaterialCommunityIcons } from '@expo/vector-icons'; import { useNavigation } from '@react-navigation/native'; const renderIcon = (library, name, size = 45, color = "#704f38") => { switch (library) { case "Feather": return ; case "Ionicons": return ; case "MaterialCommunityIcons": return ; default: return null; // Fallback if no matching library is found } }; export default function ChooseShippingScreen() { const navigation = useNavigation() const [activeShipping, setActiveShipping] = useState(0) return ( } titleStyle={{ color: "black", fontWeight: "bold", fontSize: 20 }} prefixStyle={{ backgroundColor: "transparent" }} suffixStyle={{ backgroundColor: "white", borderWidth: 1, borderColor: "black" }} containerStyle="" suffixAction={() => navigation.goBack()} /> { ChooseSippingData.map((item, index) => { const isActive = index == activeShipping return ( setActiveShipping(index)} className={`mx-4 py-10 flex-row gap-3 ${index == ChooseSippingData.length - 1 ? "" : "border-b border-gray-200"}`}> {renderIcon(item.icon.library, item.icon.name)} {item.name} {item.describe} ) }) } Apply ) } const ChooseSippingData = [ { id: 1, name: "Economy", describe: "Estimated Arrival 25 August 2023", icon: { library: "Feather", name: "box", }, }, { id: 2, name: "Regular", describe: "Estimated Arrival 25 August 2023", icon: { library: "Ionicons", name: "cube-outline", }, }, { id: 3, name: "Cargo", describe: "Estimated Arrival 25 August 2023", icon: { library: "MaterialCommunityIcons", name: "truck-check-outline", }, }, { id: 4, name: "Friend's House", describe: "2464 Royal Ln.Mesa, New Jersey 45463", icon: { library: "MaterialCommunityIcons", name: "truck-fast-outline", }, }, ];