import React, { useState } from "react"; import { View, TouchableOpacity } from "react-native"; import { Text } from "~/components/ui/text"; import BottomSheet from "~/components/ui/bottomSheet"; import { ChevronDown, Check } from "lucide-react-native"; export interface DropdownOption { label: string; value: string; } interface DropdownProps { value: string | null; options: DropdownOption[]; onSelect: (value: string) => void; placeholder?: string; } const Dropdown: React.FC = ({ value, options, onSelect, placeholder = "Select", }) => { const [open, setOpen] = useState(false); const selectedOption = options.find((opt) => opt.value === value) || null; return ( <> setOpen(true)} className="flex-row items-center justify-between w-full border border-[#D9DBE9] bg-white rounded-md px-3 py-4" > {selectedOption ? selectedOption.label : placeholder} setOpen(false)} maxHeightRatio={0.4} > {options.map((opt) => { const selected = value === opt.value; return ( { onSelect(opt.value); setOpen(false); }} className="py-3 flex-row items-center border-b border-gray-100" > {/* Radio indicator on the left */} {selected ? ( ) : ( )} {/* Label */} {opt.label} ); })} ); }; export default Dropdown;