From e3ad210a277f99bb197a78716e2e501640277e8c Mon Sep 17 00:00:00 2001 From: aelassas Date: Wed, 8 Jan 2025 13:38:18 +0100 Subject: [PATCH] Add filters button to search screen in mobile app --- mobile/components/DrawerNavigator.tsx | 4 +- mobile/lang/en.ts | 2 + mobile/lang/es.ts | 2 + mobile/lang/fr.ts | 2 + .../{CarsScreen.tsx => SearchScreen.tsx} | 62 ++++++++++++++----- 5 files changed, 56 insertions(+), 16 deletions(-) rename mobile/screens/{CarsScreen.tsx => SearchScreen.tsx} (79%) diff --git a/mobile/components/DrawerNavigator.tsx b/mobile/components/DrawerNavigator.tsx index 6ac5fc8b1..67f64c004 100644 --- a/mobile/components/DrawerNavigator.tsx +++ b/mobile/components/DrawerNavigator.tsx @@ -16,7 +16,7 @@ import ContactScreen from '@/screens/ContactScreen' import SignInScreen from '@/screens/SignInScreen' import SignUpScreen from '@/screens/SignUpScreen' import ForgotPasswordScreen from '@/screens/ForgotPasswordScreen' -import CarsScreen from '@/screens/CarsScreen' +import SearchScreen from '@/screens/SearchScreen' import * as UserService from '@/services/UserService' import i18n from '@/lang/i18n' import * as env from '@/config/env.config' @@ -190,7 +190,7 @@ const DrawerNavigator = () => { ) => { +const SearchScreen = ({ navigation, route }: NativeStackScreenProps) => { const isFocused = useIsFocused() const [language, setLanguage] = useState('') @@ -49,6 +50,7 @@ const CarsScreen = ({ navigation, route }: NativeStackScreenProps { const updateSuppliers = async () => { @@ -222,17 +224,28 @@ const CarsScreen = ({ navigation, route }: NativeStackScreenProps - - - - - - - - - - - + setShowFilters((prev) => !prev)}> + + + {showFilters ? i18n.t('HIDE_FILTERS') : i18n.t('SHOW_FILTERS')} + + + + {showFilters && ( + <> + + + + + + + + + + + + + )} {loaded && ( @@ -285,6 +298,27 @@ const styles = StyleSheet.create({ color: '#717171', marginTop: 3, }, + shwoFiltersBtn: { + flexDirection: 'row', + alignItems: 'center', + justifyContent: 'center', + backgroundColor: '#fff', + // borderColor: '#d9d8d9', + borderColor: '#f37022', + borderRadius: 4, + borderWidth: 1, + marginRight: 7, + marginBottom: 10, + marginLeft: 7, + paddingVertical: 5, + }, + shwoFiltersIcon: { + color: '#f37022', + marginRight: 5, + }, + shwoFiltersTxt: { + color: '#f37022', + } }) -export default CarsScreen +export default SearchScreen