diff --git a/.claude/settings.local.json b/.claude/settings.local.json index 2b4ba3a..a8b8198 100644 --- a/.claude/settings.local.json +++ b/.claude/settings.local.json @@ -79,7 +79,15 @@ "mcp__revenuecat__list-offerings", "mcp__revenuecat__get-product", "mcp__revenuecat__get-product-store-state", - "Bash(git reset *)" + "Bash(git reset *)", + "Bash(but branch *)", + "Bash(but commit *)", + "Bash(but stage *)", + "Bash(but diff *)", + "Bash(but log *)", + "Bash(but *)", + "Bash(git restore *)", + "Bash(npx skills *)" ], "deny": [], "defaultMode": "acceptEdits" diff --git a/package-lock.json b/package-lock.json index 2386de1..9df717b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,6 +9,7 @@ "version": "1.0.0", "dependencies": { "@expo-google-fonts/inter": "^0.4.2", + "@expo/react-native-action-sheet": "^4.1.1", "@expo/vector-icons": "^14.0.2", "@flyerhq/react-native-chat-ui": "^1.4.3", "@openspacelabs/react-native-zoomable-view": "^2.3.1", @@ -3103,6 +3104,19 @@ "node": ">=10" } }, + "node_modules/@expo/react-native-action-sheet": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/@expo/react-native-action-sheet/-/react-native-action-sheet-4.1.1.tgz", + "integrity": "sha512-4KRaba2vhqDRR7ObBj6nrD5uJw8ePoNHdIOMETTpgGTX7StUbrF4j/sfrP1YUyaPEa1P8FXdwG6pB+2WtrJd1A==", + "license": "MIT", + "dependencies": { + "@types/hoist-non-react-statics": "^3.3.1", + "hoist-non-react-statics": "^3.3.0" + }, + "peerDependencies": { + "react": ">=18.0.0" + } + }, "node_modules/@expo/schema-utils": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/@expo/schema-utils/-/schema-utils-0.1.7.tgz", @@ -5093,6 +5107,18 @@ "@types/unist": "*" } }, + "node_modules/@types/hoist-non-react-statics": { + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.7.tgz", + "integrity": "sha512-PQTyIulDkIDro8P+IHbKCsw7U2xxBYflVzW/FgWdCAePD9xGSidgA76/GeJ6lBKoblyhf9pBY763gbrN+1dI8g==", + "license": "MIT", + "dependencies": { + "hoist-non-react-statics": "^3.3.0" + }, + "peerDependencies": { + "@types/react": "*" + } + }, "node_modules/@types/istanbul-lib-coverage": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/@types/istanbul-lib-coverage/-/istanbul-lib-coverage-2.0.6.tgz", diff --git a/package.json b/package.json index 4787f7b..7862ca4 100644 --- a/package.json +++ b/package.json @@ -21,6 +21,7 @@ }, "dependencies": { "@expo-google-fonts/inter": "^0.4.2", + "@expo/react-native-action-sheet": "^4.1.1", "@expo/vector-icons": "^14.0.2", "@flyerhq/react-native-chat-ui": "^1.4.3", "@openspacelabs/react-native-zoomable-view": "^2.3.1", diff --git a/src/components/Task/AddTask.tsx b/src/components/Task/AddTask.tsx index 37988ce..97cc32b 100644 --- a/src/components/Task/AddTask.tsx +++ b/src/components/Task/AddTask.tsx @@ -12,9 +12,9 @@ import { PanResponder, Dimensions, } from "react-native"; -import { Picker } from "@react-native-picker/picker"; import DateTimePickerModal from "react-native-modal-datetime-picker"; import { Ionicons } from "@expo/vector-icons"; +import { useActionSheet } from '@expo/react-native-action-sheet'; import { addTaskToList } from "../TaskList/types"; import { getCategories } from "../../services/taskService"; import dayjs from "dayjs"; @@ -50,12 +50,11 @@ const AddTask: React.FC = ({ allowCategorySelection = false, }) => { const { t } = useTranslation(); + const { showActionSheetWithOptions } = useActionSheet(); const [categoriesOptions, setCategoriesOptions] = useState< { label: string; value: string }[] >([]); - const [localCategory, setLocalCategory] = useState( - categoryName || "" - ); + const [localCategory, setLocalCategory] = useState(""); const [categoryError, setCategoryError] = useState(""); const [priority, setPriority] = useState(1); const [title, setTitle] = useState(""); @@ -337,30 +336,44 @@ const AddTask: React.FC = ({ {allowCategorySelection && ( <> Categoria * - { + const options = [ + ...categoriesOptions.map(cat => cat.label), + 'Annulla' + ]; + const cancelButtonIndex = options.length - 1; + + showActionSheetWithOptions( + { + options, + cancelButtonIndex, + title: 'Seleziona categoria', + message: 'Scegli una categoria per il task', + }, + (buttonIndex) => { + if (buttonIndex !== cancelButtonIndex) { + setLocalCategory(categoriesOptions[buttonIndex].value); + setCategoryError(""); + } + } + ); + }} > - { - setLocalCategory(itemValue as string); - if (itemValue) setCategoryError(""); - }} - style={styles.picker} + - - {categoriesOptions.map((option, index) => ( - - ))} - - + {localCategory || "Seleziona categoria"} + + + {categoryError ? ( {categoryError} ) : null} @@ -847,10 +860,14 @@ const styles = StyleSheet.create({ fontSize: 17, fontFamily: "System", }, - dropdown: { + categoryButton: { + flexDirection: "row", + justifyContent: "space-between", + alignItems: "center", borderWidth: 1.5, borderColor: "#e1e5e9", borderRadius: 16, + padding: 16, marginBottom: 20, backgroundColor: "#ffffff", shadowColor: "#000", @@ -862,9 +879,14 @@ const styles = StyleSheet.create({ shadowRadius: 4, elevation: 1, }, - picker: { - height: 50, + categoryButtonText: { + fontSize: 17, color: "#000000", + fontFamily: "System", + fontWeight: "400", + }, + categoryPlaceholder: { + color: "#999999", }, disabledText: { color: "#ccc", diff --git a/src/navigation/index.tsx b/src/navigation/index.tsx index bce6d50..b24f224 100644 --- a/src/navigation/index.tsx +++ b/src/navigation/index.tsx @@ -9,6 +9,7 @@ import { createBottomTabNavigator } from "@react-navigation/bottom-tabs"; import { AppState, BackHandler, Linking } from "react-native"; import { GestureHandlerRootView } from "react-native-gesture-handler"; import { Ionicons } from "@expo/vector-icons"; +import { ActionSheetProvider } from '@expo/react-native-action-sheet'; import { initAnalytics, trackScreenView, @@ -588,14 +589,16 @@ export default function Navigation() { return ( - - - - - - - - + + + + + + + + + + ); }