import { useRef } from 'react' import { Pressable, StyleSheet, TextInput, View } from 'react-native' import { Icon } from '../../../components' import { AutoFocusAwareTextInput } from '../../../components/display/text_input' import { useTheme } from '../../../hooks' const PLACEHOLDER = 'Search titles and messages' interface SearchFieldProps { term: string onChange: (term: string) => void } export function SearchField({ term, onChange }: SearchFieldProps) { const styles = useStyles() const { colors } = useTheme() const inputRef = useRef(null) const clear = () => { onChange('') inputRef.current?.clear() inputRef.current?.focus() } return ( {term.length > 0 && ( )} ) } const useStyles = () => { const { colors } = useTheme() return StyleSheet.create({ container: { paddingHorizontal: 16, paddingVertical: 8, }, field: { flexDirection: 'row', alignItems: 'center', gap: 8, borderWidth: 1, borderColor: colors.borderColorDefaultBase, borderRadius: 8, paddingHorizontal: 12, paddingVertical: 8, }, input: { flex: 1, color: colors.textColorDefaultPrimary, fontSize: 16, paddingVertical: 2, }, }) }