This exercise allows you to practice and apply the concepts and techniques taught in class.
Upon completion of this exercise, you will be able to:
- Be able to create applications with persisting data.
- Implement
@react-native-async-storage/async-storage
to persist app data. - Create applications that stores and gets information from local storage.
In this lab, we're going to create a task management app. The task management app allows users to create, view, update, and delete tasks. Users can organize their tasks into different categories (e.g., personal, work, shopping) and mark tasks as completed.
For this lab, we don't have a backend or an api. Instead all data should be stored on the user device by implementing @react-native-async-storage/async-storage
.
- Fork this repo.
- Clone this repo.
- Run
nvm use
to use the node version specified in the.nvmrc
file.
nvm use
- Install the dependencies.
npm install
- Start the project.
npm run ios
npm run android
- Upon completion, run the following commands:
git add .
git commit -m "done"
git push origin master
- Create a Pull Request so your TAs can review your work.
Iteration 1: Project Setup
- Set up a new React Native project.
- Install React Navigation and its dependencies.
- Create the necessary folder structure and boilerplate files for the app (e.g., screens, components, navigation, context, types).
- Create a basic navigation structure with screens for task list, task creation, and task details.
Iteration 2: Task List Screen
- Create a simple list of tasks (mock data for now) on the task list screen.
- Define the task object type using TypeScript and use it throughout the app.
- Implement a context provider using the React Context API to manage the tasks' state. Initially, use an empty array for tasks.
- Use useReducer hook to handle actions related to tasks (e.g., add task, update task status).
- Display task titles and categories on the task list screen fetched from the context state.
- Tasks data should be store on the device.
Iteration 3: Task Creation Screen
- Create a form on the task creation screen with input fields for task title, description, and category.
- Implement an action.type pattern to handle the task creation action and update the context state accordingly.
- Upon submitting the form, add the newly created task to the task list.
Iteration 4: Task Details Screen
- Create a task details screen that shows task details (title, description, category, completion status).
- Implement an action.type pattern to handle task completion and task deletion actions.
- Allow users to mark a task as completed or delete it from the task details screen.
Iteration 5: Category Filtering
- Implement an action.type pattern to handle category actions (e.g., add category, select category).
- Add a dropdown or button on the task list screen to filter tasks by category using the selected category from the context.
Iteration 6: TypeScript Refinement
- Review the entire codebase and ensure TypeScript typings are correctly applied to all components, functions, and context.
- Handle potential errors and edge cases related to TypeScript typings.
- Implement a screen to search for tasks.
- Implement your own styles to your application ๐จ.
Happy coding! ๐