This is a React Native coding challenge that tests your ability to implement React Context patterns.
Location: /context/TaskContext.tsx
What you need to implement:
- Complete the
taskReducerfunction with ADD_TASK and DELETE_TASK logic - Implement
addTaskanddeleteTaskfunctions to add and delete fromtasksarray in state - Update
getTasksfunction to sort newest first using creation date - Ensure proper TypeScript typing throughout
Key Requirements:
- ADD_TASK should generate UUID and current timestamp
- DELETE_TASK should filter out the task with matching ID
- Functions must dispatch correct actions to the reducer
Location: /components/TaskForm.tsx
What you need to implement in handleSave function:
- Validate title isn't empty (especially handle whitespace-only input)
- Call
addTaskfrom TaskContext to save the new task - On successful save, call
onClose()to navigate back to task list
Location: /components/TaskListScreen.tsx
What you need to implement:
- Display all tasks (currently only showing first task as example)
- Handle empty state when no tasks exist
- Consider performance for large task lists (thousands of tasks)
- Implement proper task rendering logic
- Complete UI Components: TaskListScreen, TaskItem with full styling
- TypeScript Interfaces: Task, TaskState, TaskAction, TaskContextType
- Navigation Setup: Expo Router with proper screen structure
- Working Sample Data: Initial task to demonstrate the structure
-
Install dependencies
yarn install
-
Start the development server
yarn start
-
Run on device/simulator
- Press
ifor iOS simulator - Press
afor Android emulator - Scan QR code with Expo Go app
- Press