-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #46799 from software-mansion-labs/289Adam289/46027…
…-advanced-filters-keyword Add keyword advanced filter for Search
- Loading branch information
Showing
11 changed files
with
95 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import React from 'react'; | ||
import {View} from 'react-native'; | ||
import {useOnyx} from 'react-native-onyx'; | ||
import FullPageNotFoundView from '@components/BlockingViews/FullPageNotFoundView'; | ||
import FormProvider from '@components/Form/FormProvider'; | ||
import InputWrapper from '@components/Form/InputWrapper'; | ||
import type {FormOnyxValues} from '@components/Form/types'; | ||
import HeaderWithBackButton from '@components/HeaderWithBackButton'; | ||
import ScreenWrapper from '@components/ScreenWrapper'; | ||
import TextInput from '@components/TextInput'; | ||
import useAutoFocusInput from '@hooks/useAutoFocusInput'; | ||
import useLocalize from '@hooks/useLocalize'; | ||
import useThemeStyles from '@hooks/useThemeStyles'; | ||
import {updateAdvancedFilters} from '@libs/actions/Search'; | ||
import Navigation from '@libs/Navigation/Navigation'; | ||
import CONST from '@src/CONST'; | ||
import ONYXKEYS from '@src/ONYXKEYS'; | ||
import ROUTES from '@src/ROUTES'; | ||
import INPUT_IDS from '@src/types/form/SearchAdvancedFiltersForm'; | ||
|
||
function SearchFiltersKeywordPage() { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
|
||
const [searchAdvancedFiltersForm] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM); | ||
const keyword = searchAdvancedFiltersForm?.[INPUT_IDS.KEYWORD]; | ||
const {inputCallbackRef} = useAutoFocusInput(); | ||
|
||
const updateKeywordFilter = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM>) => { | ||
updateAdvancedFilters(values); | ||
Navigation.goBack(ROUTES.SEARCH_ADVANCED_FILTERS); | ||
}; | ||
|
||
return ( | ||
<ScreenWrapper | ||
testID={SearchFiltersKeywordPage.displayName} | ||
shouldShowOfflineIndicatorInWideScreen | ||
offlineIndicatorStyle={styles.mtAuto} | ||
> | ||
<FullPageNotFoundView shouldShow={false}> | ||
<HeaderWithBackButton | ||
title={translate('search.filters.keyword')} | ||
onBackButtonPress={() => { | ||
Navigation.goBack(ROUTES.SEARCH_ADVANCED_FILTERS); | ||
}} | ||
/> | ||
<FormProvider | ||
style={[styles.flex1, styles.ph5]} | ||
formID={ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM} | ||
onSubmit={updateKeywordFilter} | ||
submitButtonText={translate('common.save')} | ||
enabledWhenOffline | ||
> | ||
<View style={styles.mb4}> | ||
<InputWrapper | ||
InputComponent={TextInput} | ||
inputID={INPUT_IDS.KEYWORD} | ||
name={INPUT_IDS.KEYWORD} | ||
defaultValue={keyword} | ||
label={translate('search.filters.keyword')} | ||
accessibilityLabel={translate('search.filters.keyword')} | ||
role={CONST.ROLE.PRESENTATION} | ||
ref={inputCallbackRef} | ||
/> | ||
</View> | ||
</FormProvider> | ||
</FullPageNotFoundView> | ||
</ScreenWrapper> | ||
); | ||
} | ||
|
||
SearchFiltersKeywordPage.displayName = 'SearchFiltersKeywordPage'; | ||
|
||
export default SearchFiltersKeywordPage; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters