From 724465bf67790f1a924f0809c8faa374f6e31503 Mon Sep 17 00:00:00 2001 From: oliviaseds Date: Tue, 12 Mar 2024 09:46:53 -0400 Subject: [PATCH] refactor: remove ScrollView and non-Tailwind styling --- client/assets/close/close1.svg | 3 ++ client/assets/close/close2.svg | 3 ++ client/components/TaskType/CloseButton.tsx | 26 ++++++++++++ client/package.json | 2 +- client/screens/TaskType.tsx | 47 ++++++++++++++-------- 5 files changed, 64 insertions(+), 17 deletions(-) create mode 100644 client/assets/close/close1.svg create mode 100644 client/assets/close/close2.svg create mode 100644 client/components/TaskType/CloseButton.tsx diff --git a/client/assets/close/close1.svg b/client/assets/close/close1.svg new file mode 100644 index 0000000..6528766 --- /dev/null +++ b/client/assets/close/close1.svg @@ -0,0 +1,3 @@ + + + \ No newline at end of file diff --git a/client/assets/close/close2.svg b/client/assets/close/close2.svg new file mode 100644 index 0000000..3492923 --- /dev/null +++ b/client/assets/close/close2.svg @@ -0,0 +1,3 @@ + + + diff --git a/client/components/TaskType/CloseButton.tsx b/client/components/TaskType/CloseButton.tsx new file mode 100644 index 0000000..dc5f5d5 --- /dev/null +++ b/client/components/TaskType/CloseButton.tsx @@ -0,0 +1,26 @@ +import React from 'react'; + +import { useNavigation } from '@react-navigation/native'; +import { IconButton } from 'react-native-paper'; + +import Close1 from '../../assets/close/close1.svg'; +import Close2 from '../../assets/close/close2.svg'; +import { AppStackNavigation } from '../../navigation/AppNavigation'; + +export function CloseButton({onPress}: {onPress: () => void}) { +const navigation = useNavigation(); + +return ( + ( + <> + + + + )} + onPress={onPress} + /> +); +} diff --git a/client/package.json b/client/package.json index eda66a1..0bbbc7a 100644 --- a/client/package.json +++ b/client/package.json @@ -24,7 +24,7 @@ "@types/react": "^18.2.55", "axios": "^1.6.4", "clsx": "^2.1.0", - "expo": "^50.0.7", + "expo": "^50.0.11", "expo-document-picker": "~11.10.1", "expo-file-system": "~16.0.6", "expo-status-bar": "~1.11.1", diff --git a/client/screens/TaskType.tsx b/client/screens/TaskType.tsx index fafdffc..41993ee 100644 --- a/client/screens/TaskType.tsx +++ b/client/screens/TaskType.tsx @@ -5,7 +5,7 @@ import React, { useRef, useState } from 'react'; -import { ScrollView, View } from 'react-native'; +import { FlatList, View } from 'react-native'; import BottomSheet, { BottomSheetBackdrop } from '@gorhom/bottom-sheet'; import { BottomSheetDefaultBackdropProps } from '@gorhom/bottom-sheet/lib/typescript/components/bottomSheetBackdrop/types'; @@ -18,6 +18,7 @@ import { SafeAreaView } from 'react-native-safe-area-context'; import { BackButton } from '../components/TaskType/BackButton'; import { AppStackNavigation } from '../navigation/AppNavigation'; import { Category, categoryToTypeMap, TypeOfTask } from '../types/type'; +import { CloseButton } from '../components/TaskType/CloseButton'; export function TaskType() { const navigation = useNavigation(); @@ -43,10 +44,16 @@ export function TaskType() { value: filter })); - const snapPoints = useMemo(() => ['50%'], []); + const snapPoints = useMemo(() => ['60%'], []); const bottomSheetRef = useRef(null); + const closeBottomSheet = () => { + if (bottomSheetRef.current) { + bottomSheetRef.current.close(); // Close the BottomSheet + } + }; + const snapToIndex = (index: number) => bottomSheetRef.current?.snapToIndex(index); const renderBackdrop = useCallback( @@ -84,19 +91,23 @@ export function TaskType() { - - {selectedTypes.map((type) => ( - - ))} - + ( + + ) + } + /> + - Filter + + Filter + + +