import { useState, useEffect } from 'react'; import { View, Text, TextInput, TouchableOpacity, StyleSheet, Animated, Dimensions } from 'react-native'; import { Ionicons } from '@expo/vector-icons'; const { width } = Dimensions.get('window'); interface SearchModalProps { visible: boolean; onClose: () => void; } export default function SearchModal({ visible, onClose }: SearchModalProps) { const [searchText, setSearchText] = useState(''); const [slideAnim] = useState(new Animated.Value(width)); useEffect(() => { if (visible) { Animated.spring(slideAnim, { toValue: 0, useNativeDriver: true, tension: 65, friction: 11, }).start(); } else { Animated.timing(slideAnim, { toValue: width, duration: 250, useNativeDriver: true, }).start(); } }, [visible]); if (!visible) return null; const handleClose = () => { Animated.timing(slideAnim, { toValue: width, duration: 250, useNativeDriver: true, }).start(() => { onClose(); }); }; return ( {searchText === '' ? ( Search for outlets or articles ) : ( No results found for "{searchText}" )} ); } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', }, searchBar: { flexDirection: 'row', alignItems: 'center', paddingHorizontal: 16, paddingVertical: 12, borderBottomWidth: 1, borderBottomColor: '#e0e0e0', backgroundColor: '#fff', }, searchIcon: { marginRight: 8, }, searchInput: { flex: 1, fontSize: 16, color: '#000', padding: 8, }, closeButton: { padding: 4, }, content: { flex: 1, padding: 16, }, emptyState: { flex: 1, justifyContent: 'center', alignItems: 'center', }, emptyText: { fontSize: 16, color: '#999', marginTop: 16, textAlign: 'center', }, });