diff --git a/src/languages/en.ts b/src/languages/en.ts index e7040366dceb..92f6c5f6653e 100755 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -3761,6 +3761,7 @@ export default { search: { resultsAreLimited: 'Search results are limited.', viewResults: 'View results', + resetFilters: 'Reset filters', searchResults: { emptyResults: { title: 'Nothing to show', diff --git a/src/languages/es.ts b/src/languages/es.ts index f2a1a5b339b9..f5817394fdf7 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -3811,6 +3811,7 @@ export default { search: { resultsAreLimited: 'Los resultados de búsqueda están limitados.', viewResults: 'Ver resultados', + resetFilters: 'Restablecer filtros', searchResults: { emptyResults: { title: 'No hay nada que ver aquí', diff --git a/src/pages/Search/SearchAdvancedFiltersPage.tsx b/src/pages/Search/SearchAdvancedFiltersPage.tsx index 28241b143a9f..9c205de2433b 100644 --- a/src/pages/Search/SearchAdvancedFiltersPage.tsx +++ b/src/pages/Search/SearchAdvancedFiltersPage.tsx @@ -1,14 +1,24 @@ import React from 'react'; +import {useOnyx} from 'react-native-onyx'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; import ScreenWrapper from '@components/ScreenWrapper'; +import TextLink from '@components/TextLink'; import useLocalize from '@hooks/useLocalize'; import useThemeStyles from '@hooks/useThemeStyles'; +import * as SearchActions from '@userActions/Search'; +import ONYXKEYS from '@src/ONYXKEYS'; +import type {SearchAdvancedFiltersForm} from '@src/types/form'; import AdvancedSearchFilters from './AdvancedSearchFilters'; function SearchAdvancedFiltersPage() { const styles = useThemeStyles(); const {translate} = useLocalize(); + const emptySearchFilters: SearchAdvancedFiltersForm = {} as SearchAdvancedFiltersForm; + const [searchAdvancedFilters = emptySearchFilters] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM); + + const shouldShowResetFilters = Object.values(searchAdvancedFilters).some((value) => (Array.isArray(value) ? value.length !== 0 : !!value)); + return ( - + + {shouldShowResetFilters && {translate('search.resetFilters')}} + );