diff --git a/components/inputSearch.tsx b/components/inputSearch.tsx
index 3a930d8..39e5fe7 100644
--- a/components/inputSearch.tsx
+++ b/components/inputSearch.tsx
@@ -1,19 +1,42 @@
import { useTheme } from "@/providers/ThemeProvider";
import { Feather } from "@expo/vector-icons";
+import { useState } from "react";
+import { TouchableOpacity } from "react-native";
import { InputForm } from "./inputForm";
export default function InputSearch({ onChange, width, value, bg }: { onChange?: (val: string) => void, width?: number, value?: string, bg?: string }) {
const { colors } = useTheme();
+ const [internalValue, setInternalValue] = useState(value ?? "");
+
+ const displayValue = value !== undefined ? value : internalValue;
+
+ const handleChange = (val: string) => {
+ setInternalValue(val);
+ onChange?.(val);
+ };
+
+ const handleClear = () => {
+ setInternalValue("");
+ onChange?.("");
+ };
+
return (
}
- onChange={onChange}
+ itemRight={
+ displayValue ? (
+
+
+
+ ) : undefined
+ }
+ onChange={handleChange}
width={width}
bg={bg}
- value={value}
+ value={displayValue}
mb={false}
/>
)