import React, { useState } from 'react'; import { View, Text, StyleSheet, TouchableOpacity } from 'react-native'; import { useAppTheme } from '../context/ThemeContext'; import { Feather } from '@expo/vector-icons'; import { Popup } from './Popup'; interface DropdownProps { label?: string; value: string; options: string[]; onSelect: (val: string) => void; required?: boolean; infoText?: string; placeholder?: string; } const LIME = '#C6F135'; export const Dropdown: React.FC = ({ label, value, options, onSelect, required = false, infoText, placeholder = 'Choose an option...' }) => { const { colors, isDark } = useAppTheme(); const [isOpen, setIsOpen] = useState(false); const bg = isDark ? '#1A1A1A' : '#F5F5F5'; const border = isDark ? '#2A2A2A' : '#EEEEEE'; return ( {label && ( {label} {required ? * : (Optional)} )} setIsOpen(true)} > {value || placeholder} {infoText && {infoText}} setIsOpen(false)} title={`${label || 'Option'}`}> {options.map((opt, idx) => ( { onSelect(opt); setIsOpen(false); }} > {opt} {value === opt && } ))} ); }; const styles = StyleSheet.create({ container: { marginBottom: 18, width: '100%', }, labelRow: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'flex-end', marginBottom: 8, }, label: { fontSize: 11, fontFamily: 'Outfit_700Bold', letterSpacing: 1, textTransform: 'uppercase', }, inputBox: { height: 56, borderRadius: 14, paddingHorizontal: 16, borderWidth: 1.5, flexDirection: 'row', alignItems: 'center', justifyContent: 'space-between', }, inputText: { fontSize: 15, fontFamily: 'Outfit_500Medium', flex: 1, }, infoText: { fontSize: 12, marginTop: 6, marginLeft: 4, fontFamily: 'Outfit_400Regular', }, listContainer: { paddingTop: 8, }, optionItem: { flexDirection: 'row', justifyContent: 'space-between', alignItems: 'center', paddingVertical: 18, }, optionText: { fontSize: 15, }, });