From 5ecb12a6793f4ff91475cecab99026c0a344982a Mon Sep 17 00:00:00 2001 From: xudan Date: Mon, 21 Jul 2025 15:36:11 +0800 Subject: [PATCH] Enhance App structure by integrating TasksProvider; update BottomActionBar and TaskCard components to use React Native Paper; implement dropdowns in TaskForm; refactor TaskEditScreen and TaskListScreen to utilize context for task management. --- App.tsx | 9 +- package-lock.json | 18 ++++ package.json | 1 + src/components/BottomActionBar.tsx | 30 +++--- src/components/TaskCard.tsx | 51 +++++---- src/components/TaskForm.tsx | 163 ++++++++++++++++++----------- src/context/TasksContext.tsx | 52 +++++++++ src/data/mockData.ts | 26 ++++- src/screens/TaskEditScreen.tsx | 52 ++++++--- src/screens/TaskListScreen.tsx | 16 ++- 10 files changed, 298 insertions(+), 120 deletions(-) create mode 100644 src/context/TasksContext.tsx diff --git a/App.tsx b/App.tsx index f1e3eb1..1285d43 100644 --- a/App.tsx +++ b/App.tsx @@ -2,14 +2,17 @@ import React from 'react'; import { NavigationContainer } from '@react-navigation/native'; import AppNavigator from './src/navigation/AppNavigator'; +import { TasksProvider } from './src/context/TasksContext'; import { PaperProvider } from 'react-native-paper'; export default function App() { return ( - - - + + + + + ); } diff --git a/package-lock.json b/package-lock.json index 6678b0c..de3642f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,6 +17,7 @@ "react-native-gesture-handler": "^2.27.1", "react-native-get-random-values": "^1.11.0", "react-native-paper": "^5.14.5", + "react-native-paper-dropdown": "^2.3.1", "react-native-safe-area-context": "^5.5.2", "react-native-screens": "^4.13.1", "react-native-vector-icons": "^10.2.0", @@ -10826,6 +10827,23 @@ "react-native-safe-area-context": "*" } }, + "node_modules/react-native-paper-dropdown": { + "version": "2.3.1", + "resolved": "https://registry.npmmirror.com/react-native-paper-dropdown/-/react-native-paper-dropdown-2.3.1.tgz", + "integrity": "sha512-IvcHTucAV5+fiX2IVMiVdBDKT6KHxycW0o9QzZe7bpmeZWmuCajHDnwG3OSBGlXhUxrrM3TC0/HJZHwORWGgQg==", + "license": "MIT", + "workspaces": [ + "example" + ], + "dependencies": { + "react-native-paper": "^5.12.3" + }, + "peerDependencies": { + "react": "*", + "react-native": "*", + "react-native-paper": "*" + } + }, "node_modules/react-native-paper/node_modules/color": { "version": "3.2.1", "resolved": "https://registry.npmmirror.com/color/-/color-3.2.1.tgz", diff --git a/package.json b/package.json index b75c2dc..a16a239 100644 --- a/package.json +++ b/package.json @@ -19,6 +19,7 @@ "react-native-gesture-handler": "^2.27.1", "react-native-get-random-values": "^1.11.0", "react-native-paper": "^5.14.5", + "react-native-paper-dropdown": "^2.3.1", "react-native-safe-area-context": "^5.5.2", "react-native-screens": "^4.13.1", "react-native-vector-icons": "^10.2.0", diff --git a/src/components/BottomActionBar.tsx b/src/components/BottomActionBar.tsx index 41c17a0..259970f 100644 --- a/src/components/BottomActionBar.tsx +++ b/src/components/BottomActionBar.tsx @@ -1,5 +1,6 @@ import React from 'react'; -import { View, Button, StyleSheet } from 'react-native'; +import { Appbar, useTheme } from 'react-native-paper'; +import { StyleSheet } from 'react-native'; interface BottomActionBarProps { onRun: () => void; @@ -18,25 +19,26 @@ const BottomActionBar: React.FC = ({ onBack, isSaveDisabled = true, }) => { + const theme = useTheme(); + return ( - -