import type { Input } from "tamagui"; import { useEffect, useRef, useState } from "react"; import { FontAwesome5 } from "@expo/vector-icons"; import { useIsFocused } from "@react-navigation/native"; import { useTheme, View } from "tamagui"; import { MWInput } from "./Input"; export function SearchBar({ onSearchChange, }: { onSearchChange: (text: string) => void; }) { const theme = useTheme(); const pageIsFocused = useIsFocused(); const [keyword, setKeyword] = useState(""); const inputRef = useRef(null); useEffect(() => { if (pageIsFocused) { inputRef.current?.focus(); } }, [pageIsFocused]); const handleChange = (text: string) => { setKeyword(text); onSearchChange(text); }; return ( ); }