Files
streamyfin/components/filters/ResetFiltersButton.tsx
Gauvain d2db319593 fix(library): restore filters on new arch, shared sheet, per-library memory & full reset
- present the filter sheet imperatively from the press handler (Reanimated 4 no-op via useEffect)
- host filters in a single shared sheet to stop stacked sheets
- keep the search input responsive on large option lists (useDeferredValue)
- reset (X) also clears sort & order via a shared useFilterReset hook
- per-library filter memory, reset on app close, scroll grid back to top
- memoize useFilterOptions and drop debug logging
2026-07-15 18:51:50 +02:00

29 lines
742 B
TypeScript

import { Ionicons } from "@expo/vector-icons";
import { TouchableOpacity, type TouchableOpacityProps } from "react-native";
import { useFilterReset } from "@/hooks/useFilterReset";
interface Props extends TouchableOpacityProps {
libraryId: string;
}
export const ResetFiltersButton: React.FC<Props> = ({
libraryId,
...props
}) => {
const { hasActiveFilters, resetAllFilters } = useFilterReset(libraryId);
if (!hasActiveFilters) {
return null;
}
return (
<TouchableOpacity
onPress={resetAllFilters}
className='bg-purple-600 rounded-full w-[30px] h-[30px] flex items-center justify-center mr-1'
{...props}
>
<Ionicons name='close' size={20} color='white' />
</TouchableOpacity>
);
};